//
//  ViewHeader.m
//  NewPro
//
//  Created by 何荧红 on 2018/10/3.
//  Copyright © 2018 何荧红. All rights reserved.
//

#import "ViewHeader.h"
#import "POSActivationVC.h"
#import "NewWalletViewController.h"
#import "MyhistoryProfit.h"
#import "MyCenterVC.h"

#import "KFChatViewModel.h"

@interface ViewHeader ()
@property (nonatomic, strong) NSMutableArray *buttonArr;
@property (nonatomic, strong) UIView *SearchTypelineView;
@property (nonatomic, strong) UIView *SearchTypeView;
@property (nonatomic, strong) UIView *typeView;
@property (nonatomic, strong) UIImageView *fourup;

@property (nonatomic, assign) NSInteger ViewType;//创建头的类型
@property (nonatomic, assign) BOOL tabPush;

@property (nonatomic, strong) UIImageView *businsessimg;
@property (nonatomic, strong) UIImageView *terminalimg;
@property (nonatomic, assign) BOOL businesspush;
@property (nonatomic, assign) BOOL terminalpush;
@property (nonatomic, strong) NSMutableArray *businesstitleArr;

@property (nonatomic, strong) NSMutableArray *ScrollerButtonArr;
@property (nonatomic, strong) UIView *ScrollerlineView;

@property (nonatomic, strong) UIImageView *scanimage;
@property (nonatomic, strong) UILabel *Accumulativemoneyt;

@property (nonatomic, strong) UILabel *allmoney;//当月累计收益

@property (nonatomic, strong) UILabel *Promotetime;

@property (nonatomic, strong) UIButton *BackFrist;
@property (nonatomic, strong) UIButton *BackSecond;
@property (nonatomic, strong) UIView *BackLine;

@property (nonatomic, strong) UIButton *piliang;//批量
@property (nonatomic, strong) UIImageView *isMoneysortimg;//返现金额排序图片
@property (nonatomic, strong) UIImageView *isTimesortimg;//有效期排序图片


@end


@implementation ViewHeader
- (void)setPromotetimeStr:(NSString *)PromotetimeStr{
    _PromotetimeStr = PromotetimeStr;
    if (_PromotetimeStr.length > 0) {
        self.Promotetime.text = _PromotetimeStr;
    }
}
- (void)setMonthmoney:(NSString *)monthmoney{
    _monthmoney = monthmoney;
    if (_monthmoney.length > 0) {
        self.allmoney.text = _monthmoney;
    }
}
- (void)setAccumulativemoneytString:(NSString *)AccumulativemoneytString{
    _AccumulativemoneytString = AccumulativemoneytString;
    if (_AccumulativemoneytString) {
        if (_AccumulativemoneytString.length > 0) {
            self.Accumulativemoneyt.text = _AccumulativemoneytString;
        }else{
            self.Accumulativemoneyt.text = @"0.00";
        }
    }else{
        self.Accumulativemoneyt.text = @"0.00";
    }
}
- (void)setTraditionType:(NSInteger)TraditionType{
    _TraditionType = TraditionType;
    if (_TraditionType == 1) {
        self.step1img.image = [UIImage imageNamed:@"实名认证中"];
        self.step1lab.textColor = [UIColor colorWithHexString:@"0CA6F0"];
    }
    if (_TraditionType == 2) {
        self.stepline2.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        self.step1img.image = [UIImage imageNamed:@"实名认证完成"];
        self.step2img.image = [UIImage imageNamed:@"实名认证中"];
        self.step2lab.textColor = [UIColor colorWithHexString:@"0CA6F0"];
    }
    if (_TraditionType == 3) {
        self.stepline3.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        self.step2img.image = [UIImage imageNamed:@"实名认证完成"];
        self.step3img.image = [UIImage imageNamed:@"实名认证中"];
        self.step3lab.textColor = [UIColor colorWithHexString:@"0CA6F0"];
    }
    if (_TraditionType == 4) {
        self.stepline4.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        self.step3img.image = [UIImage imageNamed:@"实名认证完成"];
        self.step4img.image = [UIImage imageNamed:@"实名认证中"];
        self.step4lab.textColor = [UIColor colorWithHexString:@"0CA6F0"];
    }
}
- (void)setTerminalpush:(BOOL)terminalpush{
    _terminalpush = terminalpush;
    UILabel *label = self.businesstitleArr[0];
    if (_terminalpush) {
        label.textColor = [UIColor colorWithHexString:@"0CA6F0"];
        self.terminalimg.image = [UIImage imageNamed:@"蓝色上拉箭头"];
        if (self.viewpushBlock) self.viewpushBlock(@"ter");
    }else{
        label.textColor = [UIColor colorWithHexString:@"333333"];
        self.terminalimg.image = [UIImage imageNamed:@"下拉按钮"];
        if (self.viewpullBlock) self.viewpullBlock(@"ter");
    }
}
- (void)setBusinesspush:(BOOL)businesspush{
    _businesspush = businesspush;
    UILabel *label = self.businesstitleArr[1];
    if (_businesspush) {
        label.textColor = [UIColor colorWithHexString:@"0CA6F0"];
        self.businsessimg.image = [UIImage imageNamed:@"蓝色上拉箭头"];
        if (self.viewpushBlock) self.viewpushBlock(@"bus");
    }else{
        label.textColor = [UIColor colorWithHexString:@"333333"];
        self.businsessimg.image = [UIImage imageNamed:@"下拉按钮"];
        if (self.viewpullBlock) self.viewpullBlock(@"bus");
    }
}
- (void)setTabPush:(BOOL)tabPush{
    _tabPush = tabPush;
    if (_tabPush) {
        _fourup.image = [UIImage imageNamed:@"上拉按钮"];
        self.SearchTypeView.hidden = NO;
        [UIView animateWithDuration:0.3 animations:^{
            self.typeView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 96);
        }];
    }else{
        _fourup.image = [UIImage imageNamed:@"下拉按钮"];
        self.SearchTypeView.hidden = YES;
        [UIView animateWithDuration:0.3 animations:^{
            self.typeView.frame = CGRectMake(0, -1000, SCREEN_WIDTH, 96);
        }];
    }
}
- (instancetype)initWithString:(NSString *)string{
    self = [super init];
    if (self) {
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, iPhoneX_Top);
        self.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        [self CleanViewWith:string];
    }
    return self;
}
- (instancetype)initWithDefaultString:(NSString *)string{
    self = [super init];
    if (self) {
        
        self.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, iPhoneX_Top);
        [self CleanWithDefault:string];
    }
    return self;
}
- (instancetype)initWithHomeTopString:(NSString *)string{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"ececec"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, iPhoneX_Top);
        [self CleanWithHomeTop:string];
    }
    return self;
}


- (instancetype)initWithMyWalletString:(NSString *)string{
    self = [super init];
    if (self) {
        
        self.backgroundColor = [UIColor colorWithHexString:@"2582E1"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, iPhoneX_Top);
        [self CleanWithDefault:string];
    }
    return self;
}

- (instancetype)initWithMyCenter:(NSString *)string{
    self = [super init];
    if (self) {
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 145);
        self.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        [self CleanMyCenterViewWith:string];
    }
    return self;
}
- (instancetype)initWithHeaderSearch{
    self = [super init];
    if (self) {
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 203);
        self.backgroundColor = [UIColor colorWithHexString:@"f1f1f1"];
        self.buttonArr = [[NSMutableArray alloc]init];
        self.ViewType = 0;
        [self CleanTypeView];
        [self CleanSearchHeader];
    }
    return self;
}
- (instancetype)initWithPOSApplyHeader:(NSString *)String{
    self = [super init];
    if (self) {
        self.ViewType = 1;
        self.buttonArr = [[NSMutableArray alloc]init];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, iPhoneX_Top + 44);
        self.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        [self CleanPOSHeaderView:String];
    }
    return self;
}
- (instancetype)initWithImgView{//Pos详情图片页面
    self = [super init];
    if (self) {
        self.frame = CGRectMake((SCREEN_WIDTH - 225)/2, 0, 225, 345);
        self.backgroundColor = [UIColor whiteColor];
        [self CleanImgView];
    }
    return self;
}
- (instancetype)initWithAdressView:(NSInteger)type With:(AddressModel *)dic{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        if (dic) {
            type = 1;
        }else{
            type = 0;
        }
        [self CleanAdressView:type With:dic];
    }
    return self;
}
- (instancetype)initWithPosDetailViewWith:(NSDictionary *)dic{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"FAFAFA"];
        self.frame = CGRectMake(0, 10, SCREEN_WIDTH, 278);
        [self CleanShopDetailView:dic];
    }
    return self;
}
- (instancetype)initWithBackPOSHeader:(NSString *)string Sec:(NSString *)SecStr{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, iPhoneX_Top);
        [self CleanWithBackPOSHeader:string Sec:SecStr];
    }
    return self;
}
- (void)CleanWithBackPOSHeader:(NSString *)str Sec:(NSString *)SecStr{
    UIButton *back = [[UIButton alloc]init];
    [back setImage:[UIImage imageNamed:@"返回icon"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:back];
    [back mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        if (iPhoneX) {
            make.top.equalTo(self.mas_top).offset(44);
        }else{
            make.top.equalTo(self.mas_top).offset(20);
        }
        make.width.mas_equalTo(41);
        make.height.mas_equalTo(44);
    }];
    UILabel *title = [[UILabel alloc]init];
    title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    title.textColor = [UIColor colorWithHexString:@"ffffff"];
    title.text = str;
    [self addSubview:title];
    [title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(back.mas_centerY);
        make.centerX.equalTo(self.mas_centerX);
    }];
    UILabel *history = [[UILabel alloc]init];
    history.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    history.textColor = [UIColor colorWithHexString:@"ffffff"];
    history.text = SecStr;
    [self addSubview:history];
    [history mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(back.mas_centerY);
        make.right.equalTo(self.mas_right).offset(-14);
    }];
    UIButton *his = [[UIButton alloc]init];
    [his addTarget:self action:@selector(BackPOShis) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:his];
    [his mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).offset(-14);
        make.centerY.equalTo(back.mas_centerY);
        make.width.mas_equalTo(60);
        make.height.mas_equalTo(44);
    }];
}
//- (void)setLineContx:(CGFloat)lineContx{
//    _lineContx = lineContx;
//    [self.BackLine mas_updateConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.mas_left).offset(lineContx);
//        make.top.equalTo(self.BackFrist.mas_bottom).offset(-2);
//        make.width.mas_equalTo(SCREEN_WIDTH/2);
//        make.height.mas_equalTo(2);
//    }];
//}
//- (void)setBackPOSType:(NSInteger)BackPOSType{
//    _BackPOSType = BackPOSType;
//    if (_BackPOSType == 1) {
//        [self.BackFrist setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
//        [self.BackSecond setTitleColor:[UIColor colorWithHexString:@"999999"] forState:UIControlStateNormal];
//    }else if (_BackPOSType == 2){
//        [self.BackFrist setTitleColor:[UIColor colorWithHexString:@"999999"] forState:UIControlStateNormal];
//        [self.BackSecond setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
//    }
//}
//- (void)BackFristOrSecond:(UIButton *)button{
//    if ([button.titleLabel.text isEqualToString:@"我发起的"]) {
//        self.BackPOSType = 1;
//    }
//    if ([button.titleLabel.text isEqualToString:@"我接收的"]) {
//        self.BackPOSType = 2;
//    }
//    if (self.BackTypeBlock) self.BackTypeBlock(self.BackPOSType);
//}
- (void)BackPOShis{
    if (self.HeaderRightBlock) self.HeaderRightBlock();
}
-(void)setYiCHeader:(NSString *)YiCHeader{
    _YiCHeader = YiCHeader;
    if (_YiCHeader.length > 0) {
        self.Promotetime.text = _YiCHeader;
    }
}
- (instancetype)initWithYiCHeader{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, iPhoneX_Top);
        [self CleateWithYiC];
    }
    return self;
}
- (void)CleateWithYiC{
    UIButton *back = [[UIButton alloc]init];
    [back setImage:[UIImage imageNamed:@"返回icon"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(YiCBack) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:back];
    [back mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        if (iPhoneX) {
            make.top.equalTo(self.mas_top).offset(44);
        }else{
            make.top.equalTo(self.mas_top).offset(20);
        }
        make.width.mas_equalTo(41);
        make.height.mas_equalTo(44);
    }];
    self.Promotetime = [[UILabel alloc]init];
    self.Promotetime.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    self.Promotetime.textColor = [UIColor colorWithHexString:@"ffffff"];
    [self addSubview:self.Promotetime];
    [self.Promotetime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(back.mas_centerY);
        make.centerX.equalTo(self.mas_centerX);
    }];
}
- (void)YiCBack{
    [[[KFChatViewModel alloc]init] disconnect];
    [[AppDelegate sharedAppDelegate] popViewController];
}
- (instancetype)initWithBusinessView{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.frame = CGRectMake(0, iPhoneX_Top, SCREEN_WIDTH, 44);
        [self CleanBusinessView];
    }
    return self;
}
- (instancetype)initWithPostListHeader{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.frame = CGRectMake(0, 5, SCREEN_WIDTH, 25);
    }
    return self;
}
- (instancetype)initWithBusinessChoose{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.frame = CGRectMake(0, iPhoneX_Top, SCREEN_WIDTH, 25);
        [self CleanWithBusinessChoose];
    }
    return self;
}
- (instancetype)initWithKnowMore{
    self = [super init];
    if (self) {
        
        self.backgroundColor = [UIColor colorWithHexString:@"#021b2f"];
        [self CleanWithKnowMore];
    }
    return self;
}
- (void)CleanWithKnowMore{
//    CAGradientLayer *gl = [CAGradientLayer layer];
//    gl.frame = CGRectMake( 0, 0, SCREEN_WIDTH, iPhoneX_Top + 96);
//    gl.startPoint = CGPointMake(0, 0);
//    gl.endPoint = CGPointMake(1, 1);
//    gl.colors = @[(__bridge id)[UIColor colorWithRed:7/255.0 green:34/255.0 blue:51/255.0 alpha:1.0].CGColor,(__bridge id)[UIColor colorWithRed:2/255.0 green:27/255.0 blue:47/255.0 alpha:1.0].CGColor,(__bridge id)[UIColor colorWithRed:2/255.0 green:27/255.0 blue:47/255.0 alpha:1.0].CGColor];
//    gl.locations = @[@(0.0),@(0.5),@(1.0)];
//    [self.layer addSublayer:gl];
//    UIButton *back = [[UIButton alloc]init];
//    [back setImage:[UIImage imageNamed:@"返回icon"] forState:UIControlStateNormal];
//    [back addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
//    [self addSubview:back];
//    [back mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.mas_left);
//        if (iPhoneX) {
//            make.top.equalTo(self.mas_top).offset(44);
//        }else{
//            make.top.equalTo(self.mas_top).offset(20);
//        }
//        make.width.mas_equalTo(41);
//        make.height.mas_equalTo(44);
//    }];
//    UILabel *title = [[UILabel alloc]init];
//    title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
//    title.textColor = [UIColor colorWithHexString:@"ffffff"];
//    title.text = @"了解更多";
//    [self addSubview:title];
//    [title mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.centerY.equalTo(back.mas_centerY);
//        make.centerX.equalTo(self.mas_centerX);
//    }];
    UITextField *search = [[UITextField alloc]init];
    search.tag = 3684;
    search.backgroundColor = [UIColor whiteColor];
    search.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    search.layer.masksToBounds = YES;
    search.layer.cornerRadius = 3;
    search.placeholder = @"请输入关键字查询相关信息";
    [search addTarget:self action:@selector(textFieldDidEditing:) forControlEvents:UIControlEventEditingChanged];
    UIView *imag = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 42, 42)];
    UIImageView *searchImage = [[UIImageView alloc]initWithFrame:CGRectMake(15, 12.5, 17, 17)];
    searchImage.image = [UIImage imageNamed:@"搜索"];
    [imag addSubview:searchImage];
    search.leftView = imag;
    search.leftViewMode = UITextFieldViewModeAlways;
    [self addSubview:search];
    [search mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_top).offset(10);
        make.left.equalTo(self.mas_left).offset(14);
        make.right.equalTo(self.mas_right).offset(-52);
        make.height.mas_equalTo(34);
    } ];
    UILabel *subcont = [[UILabel alloc]init];
    subcont.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    subcont.textColor = [UIColor whiteColor];
    subcont.text = @"畅捷展业助手";
    [self addSubview:subcont];
    [subcont mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(search.mas_bottom).offset(20);
        make.left.equalTo(self.mas_left).offset(14);
        make.height.mas_equalTo(17);
    }];
}
- (void)CleanWithBusinessChoose{
    UILabel *title = [[UILabel alloc]init];
    title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    title.textColor = [UIColor colorWithHexString:@"333333"];
    title.text = @"序号";
    [self addSubview:title];
    [title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(self.mas_left).offset(14);
    }];
    UILabel *subnumber = [[UILabel alloc]init];
    subnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    subnumber.textColor = [UIColor colorWithHexString:@"333333"];
    subnumber.text = @"终端编号（SN）";
    [self addSubview:subnumber];
    [subnumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        if (CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)) {
            make.left.equalTo(title.mas_right).offset(14);
        }else if(CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size)){
            make.left.equalTo(title.mas_right).offset(10);
        }else{
            make.left.equalTo(title.mas_right).offset(31);
        }
    }];
    UILabel *SearchStatus = [[UILabel alloc]init];
    SearchStatus.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    SearchStatus.textColor = [UIColor colorWithHexString:@"333333"];
    SearchStatus.text = @"选择";
    [self addSubview:SearchStatus];
    [SearchStatus mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.right.equalTo(self.mas_right).offset(-14);
    }];
    UILabel *status = [[UILabel alloc]init];
    status.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    status.textColor = [UIColor colorWithHexString:@"333333"];
    status.text = @"返现金额设置范围（元）";
    [self addSubview:status];
    [status mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        if (CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)) {
            make.right.equalTo(SearchStatus.mas_left).offset(-5);
        }else if(CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size)){
            make.right.equalTo(SearchStatus.mas_left).offset(-5);
        }else{
            make.right.equalTo(SearchStatus.mas_left).offset(-14);
        }
    }];
}

- (instancetype)initWithTraditionSecView:(NSInteger)type{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self CleanTraditionView:type];
    }
    return self;
}
- (instancetype)initWithInvitationSecView{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.frame = CGRectMake(18, 114, SCREEN_WIDTH - 36, 435);
        self.layer.masksToBounds = YES;
        self.layer.cornerRadius = 5;
        self.layer.shadowColor = [UIColor colorWithRed:98/255.0 green:95/255.0 blue:95/255.0 alpha:0.4].CGColor;
        self.layer.shadowOffset = CGSizeMake(0,1);
        self.layer.shadowOpacity = 1;
        [self CleanInvitationSecView];
    }
    return self;
}
- (instancetype)initWithMyProfit{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        [self CleanMyProfit];
    }
    return self;
}
- (instancetype)initWithMyProfitTableHeader:(NSInteger)type{
    self = [super init];
    if (self) {
        if (type == 0) {
            self.backgroundColor = [UIColor colorWithHexString:@"ffffff"];
            self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 40);
        }else if(type == 1){
            self.backgroundColor = [UIColor colorWithHexString:@"ffffff"];
            self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 72);
        }else if (type == 2){
            self.backgroundColor = [UIColor colorWithHexString:@"ffffff"];
            self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 32);
        }
        [self CleanMyProfitTableHeader:type];
    }
    return self;
}
- (instancetype)initWithMyHistoryProfitSecView{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"ffffff"];
        [self CleanMyHistoryProfitSecView];
    }
    return self;
}
- (instancetype)initWithMyHistoryHeaderView{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"F0F0F0"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 32);
        [self CleanMyHistoryHeaderView];
    }
    return self;
}
- (instancetype)initWithPromote{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"F4F4F4"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 31);
        [self CleanPromoteTabHeaderView];
    }
    return self;
}
- (instancetype)initWithScrollerHeaderView:(NSInteger)type{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"ffffff"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, 44);
        self.ScrollerButtonArr = [[NSMutableArray alloc]init];
        [self CleanScrollerHeaderView:type];
    }
    return self;
}
- (instancetype)initWithLoginSecView{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"ffffff"];
        self.frame = CGRectMake(0, iPhoneX_Top, SCREEN_WIDTH, 290);
        [self CleanLoginSecView];
    }
    return self;
}
- (instancetype)initWithDefaultPos:(NSString *)string{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, iPhoneX_Top);
        [self CleanWithDefaultPos:string];
    }
    return self;
}
- (instancetype)initWithAchievementHeader{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        [self CleanWithAchievementHeader];
    }
    return self;
}
- (instancetype)initWithAchievementDetailHeader{
    self = [super init];
    if (self) {
        
        self.backgroundColor = [UIColor whiteColor];
        [self CleanWithAchievementDetailHeader];
    }
    return self;
}
- (void)CleanWithAchievementDetailHeader{
    
    UIView *sec = [[UIView alloc] init];
    sec.backgroundColor = [UIColor whiteColor];
    [self addSubview:sec];
    [sec mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.equalTo(self);
        make.height.mas_equalTo(45);
    }];
    
    UIImageView *rili = [[UIImageView alloc]init];
    rili.image = [UIImage imageNamed:@"img_rili"];
    [sec addSubview:rili];
    [rili mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(sec.mas_centerY);
        make.left.equalTo(sec.mas_left).offset(24);
        make.width.mas_equalTo(15);
        make.height.mas_equalTo(14);
    }];
    
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"YYYY"];
    NSDateFormatter *formattersec = [[NSDateFormatter alloc] init];
    [formattersec setDateFormat:@"MM"];
    NSDateFormatter *formatterThird = [[NSDateFormatter alloc] init];
    [formattersec setDateFormat:@"DD"];
    NSDate *datenow = [NSDate date];
    self.AchieveTimelab = [[UILabel alloc]init];
    self.AchieveTimelab.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.AchieveTimelab.textColor = [UIColor colorWithHexString:@"010101"];
    self.AchieveTimelab.text = [NSString stringWithFormat:@"%@年%@月%@日",[formatter stringFromDate:datenow],[formattersec stringFromDate:datenow],[formatterThird stringFromDate:datenow]];
    
    [sec addSubview:self.AchieveTimelab];
    [self.AchieveTimelab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(sec.mas_centerY);
        make.left.equalTo(rili.mas_right).offset(5);
    }];
    UIButton *timetosearch = [[UIButton alloc]init];
    timetosearch.layer.masksToBounds = YES;
    timetosearch.layer.cornerRadius = 5;
    timetosearch.layer.borderWidth = 1;
    timetosearch.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    [timetosearch setTitle:@"查询" forState:UIControlStateNormal];
    [timetosearch setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
    timetosearch.layer.borderColor = [UIColor colorWithHexString:@"0ca6f0"].CGColor;
    [timetosearch addTarget:self action:@selector(SearchWithTime:) forControlEvents:UIControlEventTouchUpInside];
    [sec addSubview:timetosearch];
    [timetosearch mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(sec.mas_centerY);
        make.right.equalTo(sec.mas_right).offset(-14);
        make.width.mas_equalTo(54);
        make.height.mas_equalTo(21);
    }];
    UIButton *timebutton = [[UIButton alloc]init];
    [timebutton addTarget:self action:@selector(SeleWithtime) forControlEvents:UIControlEventTouchUpInside];
    timebutton.backgroundColor = [UIColor colorWithWhite:0 alpha:0.1];
    [sec addSubview:timebutton];
    [timebutton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(sec.mas_centerY);
        make.left.equalTo(sec.mas_left).offset(14);
        make.right.equalTo(timetosearch.mas_left).offset(-14);
        make.height.mas_equalTo(25);
    }];
}

- (void)CleanWithAchievementHeader{
    
    UIView *sec = [[UIView alloc] init];
    sec.backgroundColor = [UIColor whiteColor];
    [self addSubview:sec];
    [sec mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self);
        make.height.mas_equalTo(45);
    }];
    
    UIImageView *rili = [[UIImageView alloc]init];
    rili.image = [UIImage imageNamed:@"img_rili"];
    [sec addSubview:rili];
    [rili mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(sec.mas_centerY);
        make.left.equalTo(sec.mas_left).offset(24);
        make.width.mas_equalTo(15);
        make.height.mas_equalTo(14);
    }];
    
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"YYYY"];
    NSDateFormatter *formattersec = [[NSDateFormatter alloc] init];
    [formattersec setDateFormat:@"MM"];
    NSDate *datenow = [NSDate date];
    self.AchieveTimelab = [[UILabel alloc]init];
    self.AchieveTimelab.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.AchieveTimelab.textColor = [UIColor colorWithHexString:@"010101"];
    self.AchieveTimelab.text = [NSString stringWithFormat:@"%@年%@月",[formatter stringFromDate:datenow],[formattersec stringFromDate:datenow]];
    
    [sec addSubview:self.AchieveTimelab];
    [self.AchieveTimelab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(sec.mas_centerY);
        make.left.equalTo(rili.mas_right).offset(5);
    }];
    UIButton *timetosearch = [[UIButton alloc]init];
    timetosearch.layer.masksToBounds = YES;
    timetosearch.layer.cornerRadius = 5;
    timetosearch.layer.borderWidth = 1;
    timetosearch.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    [timetosearch setTitle:@"查询" forState:UIControlStateNormal];
    [timetosearch setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
    timetosearch.layer.borderColor = [UIColor colorWithHexString:@"0ca6f0"].CGColor;
    [timetosearch addTarget:self action:@selector(SearchWithTime:) forControlEvents:UIControlEventTouchUpInside];
    [sec addSubview:timetosearch];
    [timetosearch mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(sec.mas_centerY);
        make.right.equalTo(sec.mas_right).offset(-14);
        make.width.mas_equalTo(54);
        make.height.mas_equalTo(21);
    }];
    UIButton *timebutton = [[UIButton alloc]init];
    [timebutton addTarget:self action:@selector(SeleWithtime) forControlEvents:UIControlEventTouchUpInside];
    timebutton.backgroundColor = [UIColor colorWithWhite:0 alpha:0.1];
    [sec addSubview:timebutton];
    [timebutton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(sec.mas_centerY);
        make.left.equalTo(sec.mas_left).offset(14);
        make.right.equalTo(timetosearch.mas_left).offset(-14);
        make.height.mas_equalTo(25);
    }];
    
    UIView *thri = [[UIView alloc] init];
    thri.backgroundColor = [UIColor colorWithHexString:@"E7EFFF"];
    [self addSubview:thri];
    
    [thri mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.height.mas_equalTo(75);
        make.left.right.equalTo(self);
        make.top.equalTo(self).offset(45);
        
    }];
    
    UILabel *achieveF = [[UILabel alloc] init];
    achieveF.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:14];
    achieveF.textColor = [UIColor colorWithHexString:@"333333"];
    achieveF.text = @"合伙人总数";
    [thri addSubview:achieveF];
    [achieveF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(thri.mas_left).offset(14);
        make.top.equalTo(thri.mas_top).offset(15);
        make.height.mas_equalTo(14);
    }];
    
    UILabel *achieveFC = [[UILabel alloc] init];
    achieveFC.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:10];
    achieveFC.textColor = [UIColor colorWithHexString:@"333333"];
    achieveFC.text = @"（个）";
    [thri addSubview:achieveFC];
    [achieveFC mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(achieveF.mas_right);
        make.bottom.equalTo(achieveF.mas_bottom);
        make.height.mas_equalTo(10);
    }];
    
    self.AchieveFTitle = [[UILabel alloc]init];
    self.AchieveFTitle.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    self.AchieveFTitle.textColor = [UIColor colorWithHexString:@"FF4C4C"];
    self.AchieveFTitle.text = @"0";
    [thri addSubview:self.AchieveFTitle];
    [self.AchieveFTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(thri.mas_left).offset(14);
        make.bottom.equalTo(thri.mas_bottom).offset(-15);
        make.height.mas_equalTo(11);
    }];
    
    UIView *lineView = [[UIView alloc]init];
    lineView.backgroundColor = [UIColor colorWithHexString:@"A6ACB6"];
    [thri addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(thri.mas_centerX);
        make.top.equalTo(thri.mas_top).offset(15);
        make.bottom.equalTo(thri.mas_bottom).offset(-15);
        make.width.mas_equalTo(1);
    }];
    
    UILabel *achieveS = [[UILabel alloc] init];
    achieveS.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:14];
    achieveS.textColor = [UIColor colorWithHexString:@"333333"];
    achieveS.text = @"商户总数";
    [thri addSubview:achieveS];
    [achieveS mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(lineView.mas_right).offset(15);
        make.top.equalTo(thri.mas_top).offset(15);
        make.height.mas_equalTo(14);
    }];
    
    UILabel *achieveSC = [[UILabel alloc] init];
    achieveSC.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:10];
    achieveSC.textColor = [UIColor colorWithHexString:@"333333"];
    achieveSC.text = @"（个）";
    [thri addSubview:achieveSC];
    [achieveSC mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(achieveS.mas_right);
        make.bottom.equalTo(achieveS.mas_bottom);
        make.height.mas_equalTo(10);
    }];
    
    
    self.AchieveSTitle = [[UILabel alloc]init];
    self.AchieveSTitle.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    self.AchieveSTitle.textColor = [UIColor colorWithHexString:@"FF4C4C"];
    self.AchieveSTitle.text = @"0";
    [thri addSubview:self.AchieveSTitle];
    [self.AchieveSTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(lineView.mas_right).offset(15);
        make.bottom.equalTo(thri.mas_bottom).offset(-15);
        make.height.mas_equalTo(11);
    }];
}
- (void)SearchWithTime:(UIButton *)button{
    if (self.AchieveTimeSearchBlock) self.AchieveTimeSearchBlock();
}
- (void)SeleWithtime{
    if (self.AchievetoTimeBlock) self.AchievetoTimeBlock();
}
- (void)CleanWithDefaultPos:(NSString *)str{//默认头，带加号
    UIButton *back = [[UIButton alloc]init];
    [back setImage:[UIImage imageNamed:@"返回icon"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:back];
    [back mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        if (iPhoneX) {
            make.top.equalTo(self.mas_top).offset(44);
        }else{
            make.top.equalTo(self.mas_top).offset(20);
        }
        make.width.mas_equalTo(41);
        make.height.mas_equalTo(44);
    }];
    UILabel *title = [[UILabel alloc]init];
    title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    title.textColor = [UIColor colorWithHexString:@"ffffff"];
    title.text = str;
    [self addSubview:title];
    [title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(back.mas_centerY);
        make.centerX.equalTo(self.mas_centerX);
    }];
    UIButton *addbutton = [[UIButton alloc]init];
    [addbutton setTitleColor:[UIColor colorWithHexString:@"ffffff"] forState:UIControlStateNormal];
    [addbutton setTitle:@"+" forState:UIControlStateNormal];
    addbutton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:36];
    [addbutton addTarget:self action:@selector(addViewPushOrPull:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:addbutton];
    [addbutton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(back.mas_centerY).offset(-2);
        make.right.equalTo(self.mas_right).offset(-2);
        make.width.mas_equalTo(44);
        make.height.mas_equalTo(44);
    }];
}
- (void)addViewPushOrPull:(UIButton *)button{
    if (self.PosAddBlock) self.PosAddBlock();
}
- (void)CleanLoginSecView{
    UIImageView *loginicon = [[UIImageView alloc]init];
    loginicon.image = [UIImage imageNamed:@"登录图标"];
    [self addSubview:loginicon];
    [loginicon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(62);
        make.height.mas_equalTo(62);
        make.top.equalTo(self.mas_top).offset(60);
        make.left.equalTo(self.mas_left).offset((SCREEN_WIDTH - 192)/2);
    }];
    UILabel *titlelab = [[UILabel alloc]init];
    titlelab.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:24];
    titlelab.textColor = [UIColor colorWithHexString:@"333333"];
    titlelab.text = @"畅享合伙人";
    titlelab.adjustsFontSizeToFitWidth = YES;
    [self addSubview:titlelab];
    [titlelab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(loginicon.mas_right).offset(10);
        make.top.equalTo(self.mas_top).offset(70);
        make.height.mas_equalTo(23);
    }];
    UILabel *subtitle = [[UILabel alloc]init];
    subtitle.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    subtitle.textColor = [UIColor colorWithHexString:@"666666"];
    subtitle.text = @"分享创新为您创造价值";
    [self addSubview:subtitle];
    [subtitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(loginicon.mas_right).offset(10);
        make.top.equalTo(self.mas_top).offset(103);
        make.height.mas_equalTo(12);
    }];
    UILabel *subaccount = [[UILabel alloc]init];
    subaccount.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
    subaccount.textColor = [UIColor colorWithHexString:@"333333"];
    subaccount.text = @"账号";
    [self addSubview:subaccount];
    [subaccount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(14);
        make.top.equalTo(loginicon.mas_bottom).offset(70);
        make.width.mas_equalTo(32);
    }];
    UILabel *subpwd = [[UILabel alloc]init];
    subpwd.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
    subpwd.textColor = [UIColor colorWithHexString:@"333333"];
    subpwd.text = @"密码";
    [self addSubview:subpwd];
    [subpwd mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(14);
        make.top.equalTo(subaccount.mas_bottom).offset(31);
        make.width.mas_equalTo(32);
    }];
    UITextField *accountText = [[UITextField alloc]init];
    accountText.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    accountText.placeholder = @"请输入账号";
    accountText.tag = 123;
    accountText.clearButtonMode = UITextFieldViewModeWhileEditing;
    [accountText addTarget:self action:@selector(textFieldDidEditing:) forControlEvents:UIControlEventEditingChanged];
    [self addSubview:accountText];
    [accountText mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(36);
        make.centerY.equalTo(subaccount.mas_centerY);
        make.left.equalTo(subaccount.mas_right).offset(20);
        make.right.equalTo(self.mas_right).offset(-14);
    }];
    UITextField *PwdText = [[UITextField alloc]init];
    PwdText.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    PwdText.placeholder = @"请输入密码";
    PwdText.secureTextEntry = YES;
    PwdText.tag = 124;
    PwdText.clearButtonMode = UITextFieldViewModeWhileEditing;
    [PwdText addTarget:self action:@selector(textFieldDidEditing:) forControlEvents:UIControlEventEditingChanged];
    [self addSubview:PwdText];
    [PwdText mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(36);
        make.centerY.equalTo(subpwd.mas_centerY);
        make.left.equalTo(subpwd.mas_right).offset(20);
        make.right.equalTo(self.mas_right).offset(-14);
    }];
    for (NSInteger i = 0; i < 2; i++) {
        UIView *line = [[UIView alloc]init];
        line.backgroundColor = [UIColor colorWithHexString:@"EEEEEE"];
        [self addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).offset(14);
            make.right.equalTo(self.mas_right);
            if (i == 0) {
                make.top.equalTo(accountText.mas_bottom);
            }else{
                make.top.equalTo(PwdText.mas_bottom);
            }
            make.height.mas_equalTo(1);
        }];
    }
}
- (void)textFieldDidEditing:(UITextField *)textField{
    if (textField.tag - 123 == 0) {
        if (self.accountBlock) self.accountBlock(textField.text);
    }
    if (textField.tag - 123 == 1) {
        if (self.pwdBlock) self.pwdBlock(textField.text);
    }
    if (textField.tag == 2314) {
        if (self.accountBlock) self.accountBlock(textField.text);
    }
    if (textField.tag == 3684) {
        if (self.SearchBlock) self.SearchBlock(textField.text);
    }
}
- (void)CleanScrollerHeaderView:(NSInteger)type{
    for (NSInteger i = 0; i < 3; i++) {
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/3 * i, 0, SCREEN_WIDTH/3, 43)];
        button.tag = 1024 + i;
        [button setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
        [button setTitleColor:[UIColor colorWithHexString:@"383838"] forState:UIControlStateSelected];
        button.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
        [button addTarget:self action:@selector(ScrollerButton:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:button];
        if (type == 0) {
            if (i == 0) {
                [button setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
                [button setTitle:@"基础" forState:UIControlStateNormal];
            }else if (i == 1){
                [button setTitleColor:[UIColor colorWithHexString:@"383838"] forState:UIControlStateNormal];
                [button setTitle:@"专业" forState:UIControlStateNormal];
            }else if (i == 2){
                [button setTitleColor:[UIColor colorWithHexString:@"383838"] forState:UIControlStateNormal];
                [button setTitle:@"实操" forState:UIControlStateNormal];
            }
        }
        if (type == 1) {
            if (i == 0) {
                [button setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
                [button setTitle:@"行业新闻" forState:UIControlStateNormal];
            }else if (i == 1){
                [button setTitleColor:[UIColor colorWithHexString:@"383838"] forState:UIControlStateNormal];
                [button setTitle:@"在线办卡" forState:UIControlStateNormal];
            }else if (i == 2){
                [button setTitleColor:[UIColor colorWithHexString:@"383838"] forState:UIControlStateNormal];
                [button setTitle:@"我要借款" forState:UIControlStateNormal];
            }
        }
        [self.ScrollerButtonArr addObject:button];
    }
    self.ScrollerlineView = [[UIView alloc]initWithFrame:CGRectMake(0, 43, SCREEN_WIDTH/3, 2)];
    self.ScrollerlineView.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
    [self addSubview:self.ScrollerlineView];
}
- (void)ScrollerButton:(UIButton *)button{
    if (self.ScrollerOfsetBlock) self.ScrollerOfsetBlock(button.frame.origin.x);
    for (UIButton *btn in self.ScrollerButtonArr) {
        if (button == btn) {
           [btn setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
        }else{
            [btn setTitleColor:[UIColor colorWithHexString:@"383838"] forState:UIControlStateNormal];
        }
    }
    [UIView animateWithDuration:0.3 animations:^{
        self.ScrollerlineView.frame = CGRectMake(button.frame.origin.x, 43, SCREEN_WIDTH/3, 2);
    }];
}
- (void)ScrollerlineViewWith:(CGFloat)ofset{
    for (UIButton *btn  in self.ScrollerButtonArr) {
        if (ofset/3 == btn.frame.origin.x) {
            [btn setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
        }else{
            [btn setTitleColor:[UIColor colorWithHexString:@"383838"] forState:UIControlStateNormal];
        }
    }
    [UIView animateWithDuration:0.3 animations:^{
        self.ScrollerlineView.frame = CGRectMake(ofset/3, 43, SCREEN_WIDTH/3, 2);
    }];
}

- (void)CleanMyHistoryHeaderView{
    UILabel *timelab = [[UILabel alloc]init];
    timelab.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
    timelab.textColor = [UIColor colorWithHexString:@"666666"];
    timelab.text = @"月份";
    [self addSubview:timelab];
    [timelab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.mas_centerY);
        make.left.equalTo(self.mas_left).offset(14);
    }];
    
    UILabel *moneytitle = [[UILabel alloc]init];
    moneytitle.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
    moneytitle.textColor = [UIColor colorWithHexString:@"666666"];
    moneytitle.text = @"交易额(万元)";
    [self addSubview:moneytitle];
    [moneytitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(timelab.mas_centerY);
        make.centerX.equalTo(self.mas_centerX);
    }];
    
    UILabel *submoney = [[UILabel alloc]init];
    submoney.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
    submoney.textColor = [UIColor colorWithHexString:@"666666"];
    submoney.text = @"收益(元)";
    [self addSubview:submoney];
    [submoney mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(timelab.mas_centerY);
        make.right.equalTo(self.mas_right).offset(-14);
    }];
}
-(void)CleanPromoteTabHeaderView{
    self.Promotetime = [[UILabel alloc]init];
    self.Promotetime.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    self.Promotetime.textColor = [UIColor colorWithHexString:@"333333"];
    [self addSubview:_Promotetime];
    [self.Promotetime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.mas_centerY);
        make.left.equalTo(self.mas_left).offset(14);
    }];
    UILabel *submoney = [[UILabel alloc]init];
    submoney.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    submoney.textColor = [UIColor colorWithHexString:@"333333"];
    submoney.text = @"分润金额 (元)";
    [self addSubview:submoney];
    [submoney mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.Promotetime.mas_centerY);
        make.right.equalTo(self.mas_right).offset(-14);
    }];
}
- (void)CleanMyHistoryProfitSecView{
    UILabel *subtitle = [[UILabel alloc]init];
    subtitle.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:15];
    subtitle.textColor = [UIColor colorWithHexString:@"666666"];
    subtitle.text = @"累计收益(元)";
    [self addSubview:subtitle];
    [subtitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.mas_top).offset(34);
        make.height.mas_equalTo(15);
    }];
    
    self.Accumulativemoneyt = [[UILabel alloc]init];
    _Accumulativemoneyt.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:24];
    _Accumulativemoneyt.textColor = [UIColor colorWithHexString:@"F86912"];
    _Accumulativemoneyt.text = @"0.00";
    [self addSubview:_Accumulativemoneyt];
    [_Accumulativemoneyt mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(subtitle.mas_bottom).offset(20);
        make.height.mas_equalTo(19);
    }];
}
- (void)CleanMyProfitTableHeader:(NSInteger)type{
    UIImageView *image = [[UIImageView alloc]init];
    UILabel *typelab = [[UILabel alloc]init];
    typelab.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:14];
    typelab.textColor = [UIColor colorWithHexString:@"383838"];
    if (type == 0) {
        image.image = [UIImage imageNamed:@"收益累计icon"];
        [self addSubview:image];
        [image mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.height.mas_equalTo(16);
            make.width.mas_equalTo(18);
            make.left.equalTo(self.mas_left).offset(14);
        }];
        typelab.text = @"收益累计";
        [self addSubview:typelab];
        [typelab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(image.mas_right).offset(9);
        }];
    }
    if (type == 1) {
        typelab.text = @"当月收益明细";
        UIView *header = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)];
        header.backgroundColor = [UIColor colorWithHexString:@"FFFFFF"];
        [self addSubview:header];
        image.image = [UIImage imageNamed:@"当月收益明细"];
        [header addSubview:image];
        [image mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(header.mas_centerY);
            make.height.mas_equalTo(16);
            make.width.mas_equalTo(18);
            make.left.equalTo(header.mas_left).offset(14);
        }];
        [header addSubview:typelab];
        [typelab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(header.mas_centerY);
            make.left.equalTo(image.mas_right).offset(9);
        }];
        UILabel *subtype = [[UILabel alloc]init];
        subtype.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
        subtype.textColor = [UIColor colorWithHexString:@"666666"];
        subtype.text = @"类别";
        [self addSubview:subtype];
        [subtype mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).offset(14);
            make.bottom.equalTo(self.mas_bottom).offset(-10);
            make.height.mas_equalTo(12);
        }];
        UILabel *submoney = [[UILabel alloc]init];
        submoney.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
        submoney.textColor = [UIColor colorWithHexString:@"666666"];
        submoney.text = @"激活量(台)";
        [self addSubview:submoney];
        [submoney mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.mas_centerX);
            make.centerY.equalTo(subtype.mas_centerY);
            make.height.mas_equalTo(12);
        }];
        UILabel *profit = [[UILabel alloc]init];
        profit.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
        profit.textColor = [UIColor colorWithHexString:@"666666"];
        profit.text = @"金额(元)";
        [self addSubview:profit];
        [profit mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_right).offset(-14);
            make.centerY.equalTo(subtype.mas_centerY);
            make.height.mas_equalTo(12);
        }];
    }
    if (type == 2) {
        UILabel *subtype = [[UILabel alloc]init];
        subtype.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
        subtype.textColor = [UIColor colorWithHexString:@"666666"];
        subtype.text = @"类别";
        [self addSubview:subtype];
        [subtype mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).offset(14);
            make.bottom.equalTo(self.mas_bottom).offset(-10);
            make.height.mas_equalTo(12);
        }];
        UILabel *submoney = [[UILabel alloc]init];
        submoney.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
        submoney.textColor = [UIColor colorWithHexString:@"666666"];
        submoney.text = @"交易额(万元)";
        [self addSubview:submoney];
        [submoney mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.mas_centerX);
            make.centerY.equalTo(subtype.mas_centerY);
            make.height.mas_equalTo(12);
        }];
        UILabel *profit = [[UILabel alloc]init];
        profit.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:12];
        profit.textColor = [UIColor colorWithHexString:@"666666"];
        profit.text = @"收益(元)";
        [self addSubview:profit];
        [profit mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_right).offset(-14);
            make.centerY.equalTo(subtype.mas_centerY);
            make.height.mas_equalTo(12);
        }];
    }
}
- (void)CleanMyProfit{

    UILabel *subtitle = [[UILabel alloc]init];
    subtitle.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:14];
    subtitle.textColor = [UIColor colorWithHexString:@"ffffff"];
    NSDate *currentDate = [NSDate date];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"MM"];
    NSInteger currentMonth = [[formatter stringFromDate:currentDate]integerValue];
    subtitle.text = [NSString stringWithFormat:@"%ld月预期收益(元）",currentMonth];
    [self addSubview:subtitle];
    [subtitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.mas_top).offset(10);
    }];
    self.allmoney = [[UILabel alloc]init];
    _allmoney.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:30];
    _allmoney.textColor = [UIColor colorWithHexString:@"ffffff"];
    _allmoney.text = @"0.0";
    [self addSubview:_allmoney];
    [_allmoney mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(subtitle.mas_bottom).offset(25);
        make.height.mas_equalTo(23);
    }];
    
    UIButton *moneybutton = [[UIButton alloc]init];
    moneybutton.layer.masksToBounds = YES;
    moneybutton.layer.cornerRadius = 15;
    moneybutton.backgroundColor = [UIColor colorWithHexString:@"FFFFFF" alpha:0.48];
    [moneybutton setTitle:@"收益结算" forState:UIControlStateNormal];
    moneybutton.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Regular" size:14];
    [moneybutton setTitleColor:[UIColor colorWithHexString:@"ffffff"] forState:UIControlStateNormal];
    [moneybutton addTarget:self action:@selector(IncomeViewController) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:moneybutton];
    [moneybutton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(30);
        make.width.mas_equalTo(110);
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.allmoney.mas_bottom).offset(25);
    }];
}
- (void)IncomeViewController{
    [[AppDelegate sharedAppDelegate] pushViewController:[[NewWalletViewController alloc]init]];
}
- (void)HistoryViewControllView{
    [[AppDelegate sharedAppDelegate] pushViewController:[[MyhistoryProfit alloc]init]];
}
- (void)CleanInvitationSecView{
    UIView *frist = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH - 36, 45)];
    frist.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
    [self addSubview:frist];
    UILabel *joinlab = [[UILabel alloc]init];
    joinlab.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    joinlab.textColor = [UIColor colorWithHexString:@"ffffff"];
    joinlab.text = @"加入我们";
    [frist addSubview:joinlab];
    [joinlab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(frist.mas_centerY);
        make.centerX.equalTo(frist.mas_centerX);
    }];
    UILabel *msgtitle = [[UILabel alloc]init];
    msgtitle.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    msgtitle.textColor = [UIColor colorWithHexString:@"666666"];
    msgtitle.text = @"扫描下方二维码，即刻成为合伙人";
    [self addSubview:msgtitle];
    [msgtitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(frist.mas_bottom).offset(20);
    }];
    self.scanimage = [[UIImageView alloc]init];
    [self addSubview:_scanimage];
    [_scanimage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(161);
        make.width.mas_equalTo(161);
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(msgtitle.mas_bottom).offset(18);
    }];
    for (NSInteger i = 0; i < 3; i++) {
        UILabel *subtitle = [[UILabel alloc]init];
        subtitle.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
        subtitle.textColor = [UIColor colorWithHexString:@"666666"];
        [self addSubview:subtitle];
        [subtitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).offset(35);
            make.top.equalTo(self.scanimage.mas_bottom).offset(37 + 49 * i);
        }];
        UILabel *conttitle = [[UILabel alloc]init];
        conttitle.tag = 2345 + i;
        conttitle.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:16];
        conttitle.textColor = [UIColor colorWithHexString:@"666666"];
        [self addSubview:conttitle];
        [conttitle mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(subtitle.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-37);
        }];
        if (i == 0) {
            subtitle.text = @"推荐码";
            conttitle.text = @"";
        }else if(i == 1){
            subtitle.text = @"推荐人";
            conttitle.text = @"";
        }else if(i == 2){
            subtitle.text = @"手机号";
            conttitle.text = @"";
        }
    }
    for (NSInteger i = 0; i < 2; i++) {
        UIView *line = [[UIView alloc]init];
        line.backgroundColor = [UIColor colorWithHexString:@"D5D5D5"];
        [self addSubview:line];
        [line mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.mas_equalTo(SCREEN_WIDTH - 60);
            make.top.equalTo(self.scanimage.mas_bottom).offset(69 + 49 * i);
            make.height.mas_equalTo(1);
            make.centerX.equalTo(self.mas_centerX);
        }];
    }
}
- (void)setInvitationdic:(NSDictionary *)Invitationdic{
    _Invitationdic = Invitationdic;
    if (_Invitationdic) {
        self.scanimage.image = [UIImage imageWithData:_Invitationdic[@"img"]];
        for (NSInteger i = 0; i < 3; i++) {
            UIView *view = [self viewWithTag:2345 + i];
            if ([view isKindOfClass:[UILabel class]]) {
                UILabel *label = (UILabel *)view;
                if (i == 0) {
                    label.text = _Invitationdic[@"recommendationCode"];
                }
                if (i == 1) {
                    label.text = _Invitationdic[@"customName"];
                }
                if (i == 2) {
                    label.text = _Invitationdic[@"phoneNumber"];
                }
            }
        }
        
    }
}
- (void)CleanTraditionView:(NSInteger)type{
    self.stepline3 = [[UIView alloc]init];
    self.stepline3.backgroundColor = [UIColor colorWithHexString:@"D8D8D8"];
    [self addSubview:self.stepline3];
    [self.stepline3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.mas_top).offset(35);
        make.width.mas_equalTo(64);
        make.height.mas_equalTo(2);
    }];
    
    self.step2img = [[UIImageView alloc]init];
    self.step2img.image = [UIImage imageNamed:@"实名未认证"];
    [self addSubview:self.step2img];
    [self.step2img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.stepline3.mas_centerY);
        make.right.equalTo(self.stepline3.mas_left).offset(-3);
        make.height.mas_equalTo(25);
        make.width.mas_equalTo(25);
    }];
    
    self.step2lab = [[UILabel alloc]init];
    self.step2lab.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.step2lab.textColor = [UIColor colorWithHexString:@"666666"];
    if (type == 0) {
        self.step2lab.text = @"手持认证";
    }else{
        self.step2lab.text = @"人脸识别";
    }
    [self addSubview:self.step2lab];
    
    [self.step2lab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.step2img.mas_centerX);
        make.top.equalTo(self.step2img.mas_bottom).offset(18);
    }];
    
    self.step3img = [[UIImageView alloc]init];
    self.step3img.image = [UIImage imageNamed:@"实名未认证"];
    [self addSubview:self.step3img];
    [self.step3img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.stepline3.mas_centerY);
        make.left.equalTo(self.stepline3.mas_right).offset(3);
        make.height.mas_equalTo(25);
        make.width.mas_equalTo(25);
    }];
    
    self.step3lab = [[UILabel alloc]init];
    self.step3lab.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.step3lab.textColor = [UIColor colorWithHexString:@"666666"];
    self.step3lab.text = @"结算银行";
    [self addSubview:self.step3lab];
    
    [self.step3lab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.step3img.mas_centerX);
        make.top.equalTo(self.step3img.mas_bottom).offset(18);
    }];
    
    
    self.stepline2 = [[UIView alloc]init];
    self.stepline2.backgroundColor = [UIColor colorWithHexString:@"D8D8D8"];
    [self addSubview:self.stepline2];
    [self.stepline2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.step2img.mas_left).offset(-3);
        make.centerY.equalTo(self.step2img.mas_centerY);
        make.width.mas_equalTo(64);
        make.height.mas_equalTo(2);
    }];
    
    self.step1img = [[UIImageView alloc]init];
    self.step1img.image = [UIImage imageNamed:@"实名认证中"];
    [self addSubview:self.step1img];
    [self.step1img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.stepline2.mas_centerY);
        make.right.equalTo(self.stepline2.mas_left).offset(-3);
        make.height.mas_equalTo(25);
        make.width.mas_equalTo(25);
    }];
    
    self.step1lab = [[UILabel alloc]init];
    self.step1lab.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.step1lab.textColor = [UIColor colorWithHexString:@"0CA6F0"];
    self.step1lab.text = @"身份资料";
    [self addSubview:self.step1lab];
    
    [self.step1lab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.step1img.mas_centerX);
        make.top.equalTo(self.step1img.mas_bottom).offset(18);
    }];
    
    
    self.stepline4 = [[UIView alloc]init];
    self.stepline4.backgroundColor = [UIColor colorWithHexString:@"D8D8D8"];
    [self addSubview:self.stepline4];
    [self.stepline4 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.step3img.mas_right).offset(3);
        make.centerY.equalTo(self.step3img.mas_centerY);
        make.width.mas_equalTo(64);
        make.height.mas_equalTo(2);
    }];
    self.step4img = [[UIImageView alloc]init];
    self.step4img.image = [UIImage imageNamed:@"实名未认证"];
    [self addSubview:self.step4img];
    [self.step4img mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.stepline4.mas_centerY);
        make.left.equalTo(self.stepline4.mas_right).offset(3);
        make.height.mas_equalTo(25);
        make.width.mas_equalTo(25);
    }];
    
    self.step4lab = [[UILabel alloc]init];
    self.step4lab.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    self.step4lab.textColor = [UIColor colorWithHexString:@"666666"];
    if (type == 0) {
        self.step4lab.text = @"确认信息";
    }else{
        self.step4lab.text = @"认证完成";
    }
    [self addSubview:self.step4lab];
    [self.step4lab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.step4img.mas_centerX);
        make.top.equalTo(self.step4img.mas_bottom).offset(18);
    }];
}
- (void)setIsPiliang:(BOOL)isPiliang{
    _isPiliang = isPiliang;
    if (_isPiliang) {
        [self.piliang setImage:[UIImage imageNamed:@"划拨批量激活"] forState:UIControlStateNormal];
    }else{
        [self.piliang setImage:[UIImage imageNamed:@"划拨批量默认"] forState:UIControlStateNormal];
    }
}
- (void)setIsTimesort:(BOOL)isTimesort{
    _isTimesort = isTimesort;
    if (_isTimesort) {
        self.isTimesortimg.image = [UIImage imageNamed:@"划拨从小到大"];
    }else{
        self.isTimesortimg.image = [UIImage imageNamed:@"划拨从大到小"];
    }
}
- (void)setIsMoneysort:(BOOL)isMoneysort{
    _isMoneysort = isMoneysort;
    if (_isMoneysort) {
        self.isMoneysortimg.image = [UIImage imageNamed:@"划拨从小到大"];
    }else{
        self.isMoneysortimg.image = [UIImage imageNamed:@"划拨从大到小"];
    }
}
//0、未激活 1、审核中 2、审核失败 3、已开通 4、已激活 5、已达标 6、已划拨 7、可回拨 8、我回拨的 9、别人回拨给我的
- (void)CleanPostlistSecView:(NSInteger)type{
    self.isPiliang = NO;
    self.isTimesort = NO;
    self.isMoneysort = NO;
    if (type == 0) {//0、未激活
        UILabel *title = [[UILabel alloc]init];
        title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        title.textColor = [UIColor colorWithHexString:@"333333"];
        title.text = @"序号";
        [self addSubview:title];
        [title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self.mas_left).offset(10);
        }];
        UILabel *subnumber = [[UILabel alloc]init];
        subnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        subnumber.textColor = [UIColor colorWithHexString:@"333333"];
        subnumber.text = @"终端编号（SN）";
        [self addSubview:subnumber];
        [subnumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            if (CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)) {
                make.left.equalTo(title.mas_right).offset(6);
            }else if(CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size)){
                make.left.equalTo(title.mas_right).offset(5);
            }else{
                make.left.equalTo(title.mas_right).offset(20);
            }
        }];
        self.piliang = [[UIButton alloc]init];
        [self.piliang setTitle:@"批量" forState:UIControlStateNormal];
        [self.piliang setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
        [self.piliang addTarget:self action:@selector(buttonIsPiliang:) forControlEvents:UIControlEventTouchUpInside];
        [self.piliang setImage:[UIImage imageNamed:@"划拨批量默认"] forState:UIControlStateNormal];
        [self addSubview:self.piliang];
        [self.piliang mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(18);
            make.width.mas_equalTo(34);
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-5);
        }];
        self.isTimesortimg = [[UIImageView alloc]init];
        self.isTimesortimg.image = [UIImage imageNamed:@"划拨排序默认"];
        [self addSubview:self.isTimesortimg];
        self.isTimesortimg.hidden = YES;
        [self.isTimesortimg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(9);
            make.width.mas_equalTo(7);
            make.right.equalTo(self.piliang.mas_left).offset(-15);
            make.centerY.equalTo(self.mas_centerY);
        }];
        UILabel *status = [[UILabel alloc]init];
        status.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        status.textColor = [UIColor colorWithHexString:@"333333"];
        status.text = @"有效期";
        [self addSubview:status];
        [status mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.isTimesortimg.mas_left).offset(-2);
        }];
        UIButton *timesortbutton = [[UIButton alloc]init];
        [timesortbutton addTarget:self action:@selector(buttonIstimeSort:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:timesortbutton];
        [timesortbutton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(25);
            make.width.mas_equalTo(50);
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.piliang.mas_left).offset(-15);
        }];
        
        self.isMoneysortimg = [[UIImageView alloc]init];
        self.isMoneysortimg.image = [UIImage imageNamed:@"划拨排序默认"];
        [self addSubview:self.isMoneysortimg];
        [self.isMoneysortimg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(9);
            make.width.mas_equalTo(7);
            make.right.equalTo(status.mas_left).offset(-25);
            make.centerY.equalTo(self.mas_centerY);
        }];
        UILabel *moneystatus = [[UILabel alloc]init];
        moneystatus.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        moneystatus.textColor = [UIColor colorWithHexString:@"333333"];
        moneystatus.text = @"返现范围";
        [self addSubview:moneystatus];
        [moneystatus mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.isMoneysortimg.mas_left).offset(-2);
        }];
        UIButton *moneysortbutton = [[UIButton alloc]init];
        [moneysortbutton addTarget:self action:@selector(buttonIsmoneySort:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:moneysortbutton];
        [moneysortbutton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(25);
            make.width.mas_equalTo(50);
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(status.mas_left).offset(-25);
        }];
    }else if (type == 1 || type == 2){//1、审核中或者审核失败
        UILabel *title = [[UILabel alloc]init];
        title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        title.textColor = [UIColor colorWithHexString:@"333333"];
        title.text = @"序号";
        [self addSubview:title];
        [title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self.mas_left).offset(26);
        }];
        UILabel *subnumber = [[UILabel alloc]init];
        subnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        subnumber.textColor = [UIColor colorWithHexString:@"333333"];
        subnumber.text = @"终端编号（SN）";
        [self addSubview:subnumber];
        [subnumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(title.mas_right).offset(79);
        }];
        UILabel *feilv = [[UILabel alloc]init];
        feilv.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        feilv.textColor = [UIColor colorWithHexString:@"333333"];
        feilv.text = @"费率";
        [self addSubview:feilv];
        [feilv mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-26);
        }];
    }else if (type == 3){//2、已开通
        UILabel *title = [[UILabel alloc]init];
        title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        title.textColor = [UIColor colorWithHexString:@"333333"];
        title.text = @"序号";
        [self addSubview:title];
        [title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self.mas_left).offset(26);
        }];
        UILabel *subnumber = [[UILabel alloc]init];
        subnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        subnumber.textColor = [UIColor colorWithHexString:@"333333"];
        subnumber.text = @"终端编号（SN）";
        [self addSubview:subnumber];
        [subnumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            if (CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)) {
                make.left.equalTo(title.mas_right).offset(26);
            }else if(CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size)){
                make.left.equalTo(title.mas_right).offset(10);
            }else{
                make.left.equalTo(title.mas_right).offset(42);
            }
        }];
        UILabel *statuse = [[UILabel alloc]init];
        statuse.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        statuse.textColor = [UIColor colorWithHexString:@"666666"];
        statuse.text = @"查询";
        [self addSubview:statuse];
        [statuse mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-26);
        }];
        self.isTimesortimg = [[UIImageView alloc]init];
        self.isTimesortimg.image = [UIImage imageNamed:@"划拨排序默认"];
        [self addSubview:self.isTimesortimg];
        self.isTimesortimg.hidden = YES;
        [self.isTimesortimg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(9);
            make.width.mas_equalTo(7);
            make.right.equalTo(statuse.mas_left).offset(-40);
            make.centerY.equalTo(self.mas_centerY);
        }];
        UILabel *status = [[UILabel alloc]init];
        status.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        status.textColor = [UIColor colorWithHexString:@"333333"];
        status.text = @"有效期";
        [self addSubview:status];
        [status mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.isTimesortimg.mas_left).offset(-2);
        }];
        UIButton *timesortbutton = [[UIButton alloc]init];
        [timesortbutton addTarget:self action:@selector(buttonIstimeSort:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:timesortbutton];
        [timesortbutton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(25);
            make.width.mas_equalTo(50);
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(statuse.mas_left).offset(-35);
        }];
    }else if (type == 4){//已激活
        UILabel *title = [[UILabel alloc]init];
        title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        title.textColor = [UIColor colorWithHexString:@"333333"];
        title.text = @"序号";
        [self addSubview:title];
        [title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self.mas_left).offset(26);
        }];
        UILabel *subnumber = [[UILabel alloc]init];
        subnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        subnumber.textColor = [UIColor colorWithHexString:@"333333"];
        subnumber.text = @"终端编号（SN）";
        [self addSubview:subnumber];
        [subnumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(title.mas_right).offset(79);
        }];
        UILabel *feilv = [[UILabel alloc]init];
        feilv.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        feilv.textColor = [UIColor colorWithHexString:@"333333"];
        feilv.text = @"查询";
        [self addSubview:feilv];
        [feilv mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-26);
        }];
    }else if (type == 5){//3、已达标
        UILabel *title = [[UILabel alloc]init];
        title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        title.textColor = [UIColor colorWithHexString:@"333333"];
        title.text = @"序号";
        [self addSubview:title];
        [title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self.mas_left).offset(26);
        }];
        UILabel *subnumber = [[UILabel alloc]init];
        subnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        subnumber.textColor = [UIColor colorWithHexString:@"333333"];
        subnumber.text = @"终端编号（SN）";
        [self addSubview:subnumber];
        [subnumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(title.mas_right).offset(42);
        }];
        UILabel *feilv = [[UILabel alloc]init];
        feilv.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        feilv.textColor = [UIColor colorWithHexString:@"333333"];
        feilv.text = @"查询";
        [self addSubview:feilv];
        [feilv mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-26);
        }];
        UILabel *monstatus = [[UILabel alloc]init];
        monstatus.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        monstatus.textColor = [UIColor colorWithHexString:@"333333"];
        monstatus.text = @"押金状态";
        [self addSubview:monstatus];
        [monstatus mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(feilv.mas_right).offset(-40);
        }];
    }else if (type == 6){//4、已划拨
        UILabel *title = [[UILabel alloc]init];
        title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        title.textColor = [UIColor colorWithHexString:@"333333"];
        title.text = @"序号";
        [self addSubview:title];
        [title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self.mas_left).offset(14);
        }];
        UILabel *subnumber = [[UILabel alloc]init];
        subnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        subnumber.textColor = [UIColor colorWithHexString:@"333333"];
        subnumber.text = @"终端编号（SN）";
        [self addSubview:subnumber];
        [subnumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            if (CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)) {
                make.left.equalTo(title.mas_right).offset(26);
            }else if(CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size)){
                make.left.equalTo(title.mas_right).offset(10);
            }else{
                make.left.equalTo(title.mas_right).offset(31);
            }
        }];
        UILabel *SearchStatus = [[UILabel alloc]init];
        SearchStatus.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        SearchStatus.textColor = [UIColor colorWithHexString:@"333333"];
        SearchStatus.text = @"查询";
        [self addSubview:SearchStatus];
        [SearchStatus mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-14);
        }];
        UILabel *status = [[UILabel alloc]init];
        status.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        status.textColor = [UIColor colorWithHexString:@"333333"];
        status.text = @"状态";
        [self addSubview:status];
        [status mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            if (CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)) {
                make.right.equalTo(SearchStatus.mas_left).offset(-40);
            }else if(CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size)){
                make.right.equalTo(SearchStatus.mas_left).offset(-40);
            }else{
                make.right.equalTo(SearchStatus.mas_left).offset(-60);
            }
        }];
    }else if (type == 7){//5、可回拨
        UILabel *title = [[UILabel alloc]init];
        title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        title.textColor = [UIColor colorWithHexString:@"333333"];
        title.text = @"序号";
        [self addSubview:title];
        [title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self.mas_left).offset(26);
        }];
        UILabel *subnumber = [[UILabel alloc]init];
        subnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        subnumber.textColor = [UIColor colorWithHexString:@"333333"];
        subnumber.text = @"终端编号（SN）";
        [self addSubview:subnumber];
        [subnumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            if (CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)) {
                make.left.equalTo(title.mas_right).offset(26);
            }else if(CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size)){
                make.left.equalTo(title.mas_right).offset(10);
            }else{
                make.left.equalTo(title.mas_right).offset(42);
            }
        }];
        self.piliang = [[UIButton alloc]init];
        [self.piliang setTitle:@"批量" forState:UIControlStateNormal];
        [self.piliang setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
        [self.piliang addTarget:self action:@selector(buttonIsPiliang:) forControlEvents:UIControlEventTouchUpInside];
        [self.piliang setImage:[UIImage imageNamed:@"划拨批量默认"] forState:UIControlStateNormal];
        [self addSubview:self.piliang];
        [self.piliang mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(18);
            make.width.mas_equalTo(34);
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-21);
        }];
        self.isTimesortimg = [[UIImageView alloc]init];
        self.isTimesortimg.image = [UIImage imageNamed:@"划拨排序默认"];
        [self addSubview:self.isTimesortimg];
        self.isTimesortimg.hidden = YES;
        [self.isTimesortimg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(9);
            make.width.mas_equalTo(7);
            make.right.equalTo(self.piliang.mas_left).offset(-35);
            make.centerY.equalTo(self.mas_centerY);
        }];
        UILabel *status = [[UILabel alloc]init];
        status.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        status.textColor = [UIColor colorWithHexString:@"333333"];
        status.text = @"有效期";
        [self addSubview:status];
        [status mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.isTimesortimg.mas_left).offset(-2);
        }];
        UIButton *timesortbutton = [[UIButton alloc]init];
        [timesortbutton addTarget:self action:@selector(buttonIstimeSort:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:timesortbutton];
        [timesortbutton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(25);
            make.width.mas_equalTo(50);
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.piliang.mas_left).offset(-35);
        }];
    }else if (type == 8 || type == 10 || type == 11){//6、我回拨的 以及历史记录
        UILabel *title = [[UILabel alloc]init];
        title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        title.textColor = [UIColor colorWithHexString:@"333333"];
        title.text = @"序号";
        [self addSubview:title];
        [title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self.mas_left).offset(26);
        }];
        UILabel *subnumber = [[UILabel alloc]init];
        subnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        subnumber.textColor = [UIColor colorWithHexString:@"333333"];
        subnumber.text = @"终端编号（SN）";
        [self addSubview:subnumber];
        [subnumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            if (CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)) {
                make.left.equalTo(title.mas_right).offset(26);
            }else if(CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size)){
                make.left.equalTo(title.mas_right).offset(10);
            }else{
                make.left.equalTo(title.mas_right).offset(42);
            }
        }];
        UILabel *statuse = [[UILabel alloc]init];
        statuse.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        statuse.textColor = [UIColor colorWithHexString:@"666666"];
        statuse.text = @"状态";
        [self addSubview:statuse];
        [statuse mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-26);
        }];
        self.isTimesortimg = [[UIImageView alloc]init];
        self.isTimesortimg.image = [UIImage imageNamed:@"划拨排序默认"];
        [self addSubview:self.isTimesortimg];
        self.isTimesortimg.hidden = YES;
        [self.isTimesortimg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(9);
            make.width.mas_equalTo(7);
            make.right.equalTo(statuse.mas_left).offset(-40);
            make.centerY.equalTo(self.mas_centerY);
        }];
        UILabel *status = [[UILabel alloc]init];
        status.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        status.textColor = [UIColor colorWithHexString:@"333333"];
        status.text = @"有效期";
        [self addSubview:status];
        [status mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.isTimesortimg.mas_left).offset(-2);
        }];
        UIButton *timesortbutton = [[UIButton alloc]init];
        [timesortbutton addTarget:self action:@selector(buttonIstimeSort:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:timesortbutton];
        [timesortbutton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(25);
            make.width.mas_equalTo(50);
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(statuse.mas_left).offset(-35);
        }];
    }else if (type == 9){//7、别人回拨给我的
        UILabel *title = [[UILabel alloc]init];
        title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        title.textColor = [UIColor colorWithHexString:@"333333"];
        title.text = @"序号";
        [self addSubview:title];
        [title mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self.mas_left).offset(26);
        }];
        UILabel *subnumber = [[UILabel alloc]init];
        subnumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        subnumber.textColor = [UIColor colorWithHexString:@"333333"];
        subnumber.text = @"终端编号（SN）";
        [self addSubview:subnumber];
        [subnumber mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            if (CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size)) {
                make.left.equalTo(title.mas_right).offset(26);
            }else if(CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size)){
                make.left.equalTo(title.mas_right).offset(10);
            }else{
                make.left.equalTo(title.mas_right).offset(42);
            }
        }];
        self.piliang = [[UIButton alloc]init];
        [self.piliang setTitle:@"批量" forState:UIControlStateNormal];
        [self.piliang setTitleColor:[UIColor clearColor] forState:UIControlStateNormal];
        [self.piliang addTarget:self action:@selector(buttonIsPiliang:) forControlEvents:UIControlEventTouchUpInside];
        [self.piliang setImage:[UIImage imageNamed:@"划拨批量默认"] forState:UIControlStateNormal];
        [self addSubview:self.piliang];
        [self.piliang mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(18);
            make.width.mas_equalTo(34);
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-21);
        }];
        self.isTimesortimg = [[UIImageView alloc]init];
        self.isTimesortimg.image = [UIImage imageNamed:@"划拨排序默认"];
        self.isTimesortimg.hidden = YES;
        [self addSubview:self.isTimesortimg];
        [self.isTimesortimg mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(9);
            make.width.mas_equalTo(7);
            make.right.equalTo(self.piliang.mas_left).offset(-35);
            make.centerY.equalTo(self.mas_centerY);
        }];
        UILabel *status = [[UILabel alloc]init];
        status.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
        status.textColor = [UIColor colorWithHexString:@"333333"];
        status.text = @"有效期";
        [self addSubview:status];
        [status mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.isTimesortimg.mas_left).offset(-2);
        }];
        UIButton *timesortbutton = [[UIButton alloc]init];
        [timesortbutton addTarget:self action:@selector(buttonIstimeSort:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:timesortbutton];
        [timesortbutton mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.mas_equalTo(25);
            make.width.mas_equalTo(50);
            make.centerY.equalTo(self.mas_centerY);
            make.right.equalTo(self.piliang.mas_left).offset(-35);
        }];
    }
}
- (void)buttonIsPiliang:(UIButton *)button{
    self.isPiliang = !self.isPiliang;
    if (self.piliangBlock) self.piliangBlock(self.isPiliang);
}
- (void)buttonIstimeSort:(UIButton *)button{
    //暂时注释
//    self.isTimesort = !self.isTimesort;
//    self.isMoneysort = NO;
//    self.isMoneysortimg.image = [UIImage imageNamed:@"划拨排序默认"];
//    if (self.timesortBlock) self.timesortBlock(self.isTimesort);
}
- (void)buttonIsmoneySort:(UIButton *)button{
    self.isMoneysort = !self.isMoneysort;
    self.isTimesort = NO;
    self.isTimesortimg.image = [UIImage imageNamed:@"划拨排序默认"];
    if (self.moneysortBlock) self.moneysortBlock(self.isMoneysort);
}
- (void)CleanBusinessView{
    self.businesstitleArr = [[NSMutableArray alloc]init];
    for (NSInteger i = 0; i < 2; i++) {
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2 * i, 0, SCREEN_WIDTH/2, 44)];
        button.tag = 2018 + i;
        [button addTarget:self action:@selector(buttonClik:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:button];
        UILabel *label = [[UILabel alloc]init];
        label.tag = 18 + i;
        label.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:15];
        label.textColor = [UIColor colorWithHexString:@"333333"];
        [self insertSubview:label belowSubview:button];
        [label mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(button.mas_centerY);
            make.centerX.equalTo(button.mas_centerX).offset(-11);
        }];
        if (i == 0) {
            label.text = @"终端列表";
            self.terminalimg = [[UIImageView alloc]init];
            self.terminalimg.image = [UIImage imageNamed:@"下拉按钮"];
            [self insertSubview:self.terminalimg belowSubview:button];
            [self.terminalimg mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(button.mas_centerY);
                make.left.equalTo(label.mas_right).offset(2);
                make.height.mas_equalTo(5);
                make.width.mas_equalTo(9);
            }];
        }
        if (i == 1) {
            label.text = @"商户拓展";
            self.businsessimg = [[UIImageView alloc]init];
            self.businsessimg.image = [UIImage imageNamed:@"下拉按钮"];
            [self addSubview:self.businsessimg];
            [self.businsessimg mas_makeConstraints:^(MASConstraintMaker *make) {
                make.centerY.equalTo(button.mas_centerY);
                make.left.equalTo(label.mas_right).offset(2);
                make.height.mas_equalTo(5);
                make.width.mas_equalTo(9);
            }];
        }
        [self.businesstitleArr addObject:label];
    }
    UIView *line = [[UIView alloc]init];
    line.backgroundColor = [UIColor colorWithHexString:@"F4F4F4"];
    [self addSubview:line];
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.mas_top);
        make.height.mas_equalTo(44);
        make.width.mas_equalTo(1);
    }];
}
- (void)buttonClik:(UIButton *)button{
    if (button.tag - 2018 == 0) {
        if (!self.terminalpush) {
            if (self.businesspush) {
                self.businesspush = NO;
                self.terminalpush = YES;
            }else{
                self.terminalpush = YES;
            }
        }else{
            self.businesspush = NO;
            self.terminalpush = NO;
        }
    }
    if (button.tag - 2018 == 1) {
        if (!self.businesspush) {
            if (self.terminalpush) {
                self.businesspush = YES;
                self.terminalpush = NO;
            }else{
                self.businesspush = YES;
            }
        }else{
            self.businesspush = NO;
            self.terminalpush = NO;
        }
    }
}
- (void)CleanWithHomeTop:(NSString *)str{
    UIButton *back = [[UIButton alloc]init];
    [back setImage:[UIImage imageNamed:@"首页黑色返回"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:back];
    [back mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        if (iPhoneX) {
            make.top.equalTo(self.mas_top).offset(44);
        }else{
            make.top.equalTo(self.mas_top).offset(20);
        }
        make.width.mas_equalTo(41);
        make.height.mas_equalTo(44);
    }];
    UILabel *title = [[UILabel alloc]init];
    title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    title.textColor = [UIColor colorWithHexString:@"181818"];
    title.text = str;
    [self addSubview:title];
    [title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(back.mas_centerY);
        make.centerX.equalTo(self.mas_centerX);
    }];
}
- (void)CleanWithDefault:(NSString *)str{//默认头，带返回
    UIButton *back = [[UIButton alloc]init];
    [back setImage:[UIImage imageNamed:@"返回icon"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:back];
    [back mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        if (iPhoneX) {
            make.top.equalTo(self.mas_top).offset(44);
        }else{
            make.top.equalTo(self.mas_top).offset(20);
        }
        make.width.mas_equalTo(41);
        make.height.mas_equalTo(44);
    }];
    UILabel *title = [[UILabel alloc]init];
    title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    title.textColor = [UIColor colorWithHexString:@"ffffff"];
    title.text = str;
    [self addSubview:title];
    [title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(back.mas_centerY);
        make.centerX.equalTo(self.mas_centerX);
    }];
}
- (void)CleanShopDetailView:(NSDictionary *)dic{
    
    UILabel *frist = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 44)];
    frist.backgroundColor = [UIColor whiteColor];
    frist.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    frist.textColor = [UIColor colorWithHexString:@"383838"];
    frist.text = @"   商品详情";
    [self addSubview:frist];
    UIView *secView = [[UIView alloc]initWithFrame:CGRectMake(0, 44, SCREEN_WIDTH, 123)];
    secView.backgroundColor = [UIColor colorWithHexString:@"FAFAFA"];
    [self addSubview:secView];
    UIImageView *image = [[UIImageView alloc]init];
    [image sd_setImageWithURL:[NSURL URLWithString:dic[@"imgPath"]]];
    [secView addSubview:image];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(115);
        make.width.mas_equalTo(58);
        make.centerY.equalTo(secView.mas_centerY);
        make.left.equalTo(secView.mas_left).offset(15);
    }];
    UILabel *detail = [[UILabel alloc]init];
    detail.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
    detail.textColor = [UIColor colorWithHexString:@"383838"];
    detail.text = dic[@"sellName"];
    [secView addSubview:detail];
    [detail mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(secView.mas_top).offset(33);
        make.left.equalTo(image.mas_right).offset(17);
    }];
    UILabel *money = [[UILabel alloc]init];
    money.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
    money.textColor = [UIColor colorWithHexString:@"FF2F2F"];
    money.text = [NSString stringWithFormat:@"¥%@",dic[@"price"]];
    [secView addSubview:money];
    [money mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(detail.mas_bottom).offset(29);
        make.left.equalTo(image.mas_right).offset(17);
    }];
    UIView *addview = [[UIView alloc]initWithFrame:CGRectMake(0, 167, SCREEN_WIDTH, 55)];
    addview.backgroundColor = [UIColor whiteColor];
    [self addSubview:addview];
    UILabel *buynumber = [[UILabel alloc]init];
    buynumber.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    buynumber.textColor = [UIColor colorWithHexString:@"383838"];
    buynumber.text = @"购买数量";
    [addview addSubview:buynumber];
    [buynumber mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(addview.mas_centerY);
        make.left.equalTo(addview.mas_left).offset(14);
    }];
    UIButton *addbutton = [[UIButton alloc]init];
    addbutton.alpha = 0;
    addbutton.backgroundColor = [UIColor colorWithHexString:@"F4F4F4"];
    addbutton.titleLabel.font = [UIFont systemFontOfSize:24];
    [addbutton setTitle:@"+" forState:UIControlStateNormal];
    [addbutton setTitleColor:[UIColor colorWithHexString:@"666666"] forState:UIControlStateNormal];
    [addbutton addTarget:self action:@selector(add:) forControlEvents:UIControlEventTouchUpInside];
    [addview addSubview:addbutton];
    [addbutton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(addview.mas_centerY);
        make.right.equalTo(addview.mas_right).offset(-14);
        make.height.mas_equalTo(27);
        make.width.mas_equalTo(27);
    }];
    
    self.numberlab = [[UITextField alloc]init];
    self.numberlab.enabled = NO;
    self.numberlab.tag = 2314;
    self.numberlab.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:14];
    self.numberlab.textColor = [UIColor colorWithHexString:@"383838"];
    self.numberlab.text = @"1";
    [self.numberlab addTarget:self action:@selector(textFieldDidEditing:) forControlEvents:UIControlEventEditingChanged];
    [addview addSubview:self.numberlab];
    [self.numberlab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(addbutton.mas_centerY);
        make.right.equalTo(addbutton.mas_left).offset(-15);
    }];
    
    
    UIButton *reduc = [[UIButton alloc]init];
    reduc.alpha = 0;
    reduc.titleLabel.font = [UIFont systemFontOfSize:24];
    reduc.backgroundColor = [UIColor colorWithHexString:@"F4F4F4"];
    [reduc setTitle:@"-" forState:UIControlStateNormal];
    [reduc setTitleColor:[UIColor colorWithHexString:@"666666"] forState:UIControlStateNormal];
    [reduc addTarget:self action:@selector(reduce:) forControlEvents:UIControlEventTouchUpInside];
    [addview addSubview:reduc];
    [reduc mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(addbutton.mas_centerY);
        make.right.equalTo(self.numberlab.mas_left).offset(-15);
        make.height.mas_equalTo(27);
        make.width.mas_equalTo(27);
    }];
    
    UIView *lastView = [[UIView alloc]initWithFrame:CGRectMake(0, 223, SCREEN_WIDTH, 55)];
    lastView.backgroundColor = [UIColor whiteColor];
    [self addSubview:lastView];
    UILabel *buyType = [[UILabel alloc]init];
    buyType.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    buyType.textColor = [UIColor colorWithHexString:@"383838"];
    buyType.text = @"配送方式";
    [lastView addSubview:buyType];
    [buyType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(lastView.mas_centerY);
        make.left.equalTo(lastView.mas_left).offset(14);
    }];
    UILabel *subType = [[UILabel alloc]init];
    subType.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    subType.textColor = [UIColor colorWithHexString:@"666666"];
    subType.text = @"快递 免邮";
    [lastView addSubview:subType];
    [subType mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(lastView.mas_centerY);
        make.right.equalTo(lastView.mas_right).offset(-14);
    }];
}
- (void)add:(UIButton *)button{
    NSInteger number = [self.numberlab.text integerValue];
    number += 1;
    self.numberlab.text = [NSString stringWithFormat:@"%ld",number];
    if (self.accountBlock) self.accountBlock(self.numberlab.text);
}
- (void)reduce:(UIButton *)button{
    NSInteger number = [self.numberlab.text integerValue];
    number -= 1;
    if (number >= 0) {
        self.numberlab.text = [NSString stringWithFormat:@"%ld",number];
    }else{
        self.numberlab.text = @"0";
    }
    if (self.accountBlock) self.accountBlock(self.numberlab.text);
}

- (void)CleanAdressView:(NSInteger)type With:(AddressModel *)dic{
    for (UIView *View in self.subviews) {
        [View removeFromSuperview];
    }
    if (type == 0) {
        self.frame = CGRectMake(0, iPhoneX_Top, SCREEN_WIDTH, 54);
        UILabel *adrress = [[UILabel alloc]init];
        adrress.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
        adrress.textColor = [UIColor colorWithHexString:@"666666"];
        adrress.text = @"请选择收货地址";
        [self addSubview:adrress];
        [adrress mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self.mas_left).offset(14);
        }];
        UIImageView *right = [[UIImageView alloc]init];
        right.image = [UIImage imageNamed:@"灰色右箭头"];
        [self addSubview:right];
        [right mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(adrress.mas_centerY);
            make.width.mas_equalTo(8);
            make.height.mas_equalTo(14);
            make.right.equalTo(self.mas_right).offset(-14);
        }];
        UIButton *toAdress = [[UIButton alloc]init];
        [toAdress addTarget:self action:@selector(ButtonToAdress) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:toAdress];
        [toAdress mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left);
            make.right.equalTo(self.mas_right);
            make.top.equalTo(self.mas_top);
            make.bottom.equalTo(self.mas_bottom);
        }];
    }else{
        self.frame = CGRectMake(0, iPhoneX_Top, SCREEN_WIDTH, 96);
        UIImageView *adressicon = [[UIImageView alloc]init];
        adressicon.image = [UIImage imageNamed:@"机具申领地址"];
        [self addSubview:adressicon];
        [adressicon mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.left.equalTo(self.mas_left).offset(14);
            make.width.mas_equalTo(13);
            make.height.mas_equalTo(16);
        }];
        
        UILabel *adrressname = [[UILabel alloc]init];
        adrressname.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
        adrressname.textColor = [UIColor colorWithHexString:@"383838"];
        adrressname.text = [NSString stringWithFormat:@"收货人：%@",dic.name];
        [self addSubview:adrressname];
        [adrressname mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.mas_top).offset(20);
            make.left.equalTo(self.mas_left).offset(37);
            make.height.mas_equalTo(14);
        }];
        
        UILabel *adrressphone = [[UILabel alloc]init];
        adrressphone.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
        adrressphone.textColor = [UIColor colorWithHexString:@"383838"];
        adrressphone.text = [NSString stringWithFormat:@"%@",dic.phone];
        [self addSubview:adrressphone];
        [adrressphone mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(adrressname.mas_centerY);
            make.right.equalTo(self.mas_right).offset(-32);
        }];
        UILabel *adrress = [[UILabel alloc]init];
        adrress.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
        adrress.numberOfLines = 2;
        adrress.textColor = [UIColor colorWithHexString:@"383838"];
        adrress.text = [NSString stringWithFormat:@"%@",dic.address];
        [self addSubview:adrress];
        [adrress mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(adrressname.mas_bottom).offset(15);
            make.left.equalTo(self.mas_left).offset(37);
            make.right.equalTo(self.mas_right).offset(-42);
        }];
        UIImageView *right = [[UIImageView alloc]init];
        right.image = [UIImage imageNamed:@"灰色右箭头"];
        [self addSubview:right];
        [right mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.width.mas_equalTo(8);
            make.height.mas_equalTo(14);
            make.right.equalTo(self.mas_right).offset(-14);
        }];
        UIButton *toAdress = [[UIButton alloc]init];
        [toAdress addTarget:self action:@selector(ButtonToAdress) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:toAdress];
        [toAdress mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left);
            make.right.equalTo(self.mas_right);
            make.top.equalTo(self.mas_top);
            make.bottom.equalTo(self.mas_bottom);
        }];
        
        
    }
}
- (void)ButtonToAdress{
    if (self.toAdressBlock) self.toAdressBlock();
}
- (void)CleanImgView{
    UIImageView *image = [[UIImageView alloc]init];
    [self addSubview:image];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.height.mas_equalTo(145);
        make.width.mas_equalTo(77);
        make.top.equalTo(self.mas_top).offset(29);
    }];
    UILabel *type = [[UILabel alloc]init];
    type.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:15];
    type.textColor = [UIColor colorWithHexString:@"AC9376"];
    type.text = @"电签款";
    [self addSubview:type];
    [type mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(14);
        make.top.equalTo(image.mas_bottom).offset(17);
    }];
    UILabel *subtype = [[UILabel alloc]init];
    subtype.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:10];
    subtype.textColor = [UIColor colorWithHexString:@"AC9376"];
    subtype.text = @"(无签购单)";
    [self addSubview:subtype];
    [subtype mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(type.mas_right);
        make.centerY.equalTo(type.mas_centerY).offset(2);
    }];
    UILabel *type1 = [[UILabel alloc]init];
    type1.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:13];
    type1.textColor = [UIColor colorWithHexString:@"5A5E66"];
    type1.text = @"畅享送传统POS丨1台";
    [self addSubview:type1];
    [type1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(14);
        make.top.equalTo(type.mas_bottom).offset(12);
    }];
    UILabel *subtype1 = [[UILabel alloc]init];
    subtype1.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:8];
    subtype1.textColor = [UIColor colorWithHexString:@"FF4040"];
    subtype1.text = @"(不参与活动政策)";
    [self addSubview:subtype1];
    [subtype1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(type1.mas_right);
        make.centerY.equalTo(type1.mas_centerY).offset(2);
    }];
    UILabel *youhuitype = [[UILabel alloc]init];
    youhuitype.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:11];
    youhuitype.textColor = [UIColor colorWithHexString:@"5A5E66"];
    youhuitype.text = @"激活";
    [self addSubview:youhuitype];
    [youhuitype mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(14);
        make.top.equalTo(type1.mas_bottom).offset(10);
    }];
    UILabel *youhuitype1 = [[UILabel alloc]init];
    youhuitype1.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    youhuitype1.textColor = [UIColor colorWithHexString:@"FF4040"];
    youhuitype1.text = @"返现188元/台";
    [self addSubview:youhuitype1];
    [youhuitype1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(youhuitype.mas_right);
        make.centerY.equalTo(youhuitype.mas_centerY).offset(-2);
    }];
    UILabel *youhuitype2 = [[UILabel alloc]init];
    youhuitype2.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:10];
    youhuitype2.textColor = [UIColor colorWithHexString:@"00A0E9"];
    youhuitype2.text = @"商户6个月刷满30万系统每台返还188元";
    [self addSubview:youhuitype2];
    [youhuitype2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(14);
        make.top.equalTo(youhuitype.mas_bottom).offset(10);
    }];
    UILabel *youhuitypetime = [[UILabel alloc]init];
    youhuitypetime.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:8];
    youhuitypetime.textColor = [UIColor colorWithHexString:@"5A5E66"];
    youhuitypetime.text = @"活动时间截止2018年12月31日";
    [self addSubview:youhuitypetime];
    [youhuitypetime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(14);
        make.top.equalTo(youhuitype2.mas_bottom).offset(10);
    }];
    UILabel *money = [[UILabel alloc]init];
    money.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:18];
    money.textColor = [UIColor colorWithHexString:@"FF4040"];
    money.text = @"¥188";
    [self addSubview:money];
    [money mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(14);
        make.top.equalTo(youhuitypetime.mas_bottom).offset(10);
    }];
}
- (void)CleanTypeView{
    self.tabPush = NO;
    self.SearchTypeView = [[UIView alloc]initWithFrame:CGRectMake(0, 204, SCREEN_WIDTH, SCREEN_HEIGHT - 204)];
    self.SearchTypeView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3];
    self.SearchTypeView.hidden = YES;
    UIButton *bgbutton = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 204)];
    [bgbutton addTarget:self action:@selector(TypePush) forControlEvents:UIControlEventTouchUpInside];
    [self.SearchTypeView addSubview:bgbutton];
    self.typeView = [[UIView alloc]initWithFrame:CGRectMake(0, -1000, SCREEN_WIDTH, 96)];
    self.typeView.backgroundColor = [UIColor whiteColor];
    [self.SearchTypeView addSubview:self.typeView];
    [self addSubview:self.SearchTypeView];
}
- (void)TypePush{
    self.tabPush = !self.tabPush;
}
- (void)CleanViewWith:(NSString *)title{
    UILabel *titleLab = [[UILabel alloc]init];
    titleLab.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    titleLab.textColor = [UIColor colorWithHexString:@"FFFFFF"];
    titleLab.text = title;
    [self addSubview:titleLab];
    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        if (iPhoneX) {
            make.centerY.equalTo(self.mas_centerY).offset(21);
        }else{
            make.centerY.equalTo(self.mas_centerY).offset(10);
        }
    }];
}
- (void)CleanMyCenterViewWith:(NSString *)title{
    UILabel *titleLab = [[UILabel alloc]init];
    titleLab.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    titleLab.textColor = [UIColor colorWithHexString:@"FFFFFF"];
    titleLab.text = title;
    [self addSubview:titleLab];
    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.mas_centerX);
        make.top.equalTo(self.mas_top).offset(34);
    }];
    
    UIImageView *myimg = [[UIImageView alloc]init];
    myimg.image = [UIImage imageNamed:@"头像"];
    [self addSubview:myimg];
    [myimg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(60);
        make.width.mas_equalTo(60);
        make.left.equalTo(self.mas_left).offset(16);
        make.bottom.equalTo(self.mas_bottom).offset(-18);
    }];
    UILabel *name = [[UILabel alloc]init];
    name.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:16];
    name.textColor = [UIColor colorWithHexString:@"F7F3F7"];
    name.text = @"畅享合伙人";
    [self addSubview:name];
    [name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(myimg.mas_right).offset(17);
        make.top.equalTo(myimg.mas_top).offset(9);
    }];
    UILabel *phone = [[UILabel alloc]init];
    phone.textColor = [UIColor colorWithHexString:@"FEFEFE"];
    phone.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:12];
    phone.text = @"134******98";
    phone.layer.masksToBounds = YES;
    phone.layer.cornerRadius = 11;
    phone.layer.borderWidth = 0.5;
    phone.layer.borderColor = [UIColor colorWithHexString:@"CFA972"].CGColor;
    [self addSubview:phone];
    [phone mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.mas_equalTo(22);
        make.left.equalTo(myimg.mas_right).offset(17);
        make.top.equalTo(name.mas_bottom).offset(5);
    }];
    UIImageView *right = [[UIImageView alloc]init];
    right.image = [UIImage imageNamed:@"白色右箭头"];
    [self addSubview:right];
    [right mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(7);
        make.height.mas_equalTo(12);
        make.centerY.equalTo(myimg.mas_centerY);
        make.right.equalTo(self.mas_right).offset(-16);
    }];
    
    UIImageView *icon = [[UIImageView alloc]init];
    icon.image = [UIImage imageNamed:@"ICON_EWM"];
    [self addSubview:icon];
    [icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(21);
        make.height.mas_equalTo(21);
        make.centerY.equalTo(myimg.mas_centerY);
        make.right.equalTo(right.mas_left).offset(-10);
    }];
    UIButton *clik = [[UIButton alloc]init];
    [clik addTarget:self action:@selector(buttonClik) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:clik];
    [clik mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.bottom.mas_equalTo(0);
        make.right.mas_equalTo(-75);
    }];
}
- (void)CleanSearchHeader{
    UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 64)];
    headerView.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
    [self addSubview:headerView];
    UITextField *search = [[UITextField alloc]init];
    search.backgroundColor = [UIColor whiteColor];
    search.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    search.layer.masksToBounds = YES;
    search.layer.cornerRadius = 17;
    search.placeholder = @"姓名";
    UIView *imag = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 42, 42)];
    UIImageView *searchImage = [[UIImageView alloc]initWithFrame:CGRectMake(15, 12.5, 17, 17)];
    searchImage.image = [UIImage imageNamed:@"搜索"];
    [imag addSubview:searchImage];
    search.leftView = imag;
    search.leftViewMode = UITextFieldViewModeAlways;
    [headerView addSubview:search];
    [search mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(headerView.mas_top).offset(25);
        make.centerX.equalTo(headerView.mas_centerX);
        make.left.equalTo(headerView.mas_left).offset(48);
        make.right.equalTo(headerView.mas_right).offset(-48);
        make.height.mas_equalTo(34);
    } ];
    [self CleanSearchSecView];
    UIView *thirView = [[UIView alloc]initWithFrame:CGRectMake(0, 109, SCREEN_WIDTH, 63)];
    thirView.backgroundColor = [UIColor whiteColor];
    UIImageView *userimg = [[UIImageView alloc]init];
    userimg.image = [UIImage imageNamed:@"头像"];
    [thirView addSubview:userimg];
    [userimg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(thirView.mas_left).offset(14);
        make.centerY.equalTo(thirView.mas_centerY);
        make.height.mas_equalTo(43);
        make.width.mas_equalTo(43);
    }];
    UILabel *name = [[UILabel alloc]init];
    name.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:15];
    name.textColor = [UIColor colorWithHexString:@"333333"];
    name.text = @"江苏拓步信息";
    [thirView addSubview:name];
    [name mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(userimg.mas_centerY);
        make.left.equalTo(userimg.mas_right).offset(10);
    }];
    UIImageView *tuijian = [[UIImageView alloc]init];
    tuijian.image = [UIImage imageNamed:@"推荐人"];
    [thirView addSubview:tuijian];
    [tuijian mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(userimg.mas_centerY);
        make.height.mas_equalTo(25);
        make.width.mas_equalTo(75);
        make.right.equalTo(thirView.mas_right).offset(-14);
    }];
    UIButton *tuijianbutton = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 63)];
    [tuijianbutton addTarget:self action:@selector(TotuijianView) forControlEvents:UIControlEventTouchUpInside];
    [thirView addSubview:tuijianbutton];
    [self addSubview:thirView];
    
    UIView *fourView = [[UIView alloc]initWithFrame:CGRectMake(0, 173, SCREEN_WIDTH, 30)];
    fourView.backgroundColor = [UIColor whiteColor];
    UILabel *fourtitle = [[UILabel alloc]init];
    fourtitle.textColor = [UIColor colorWithHexString:@"666666"];
    fourtitle.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:14];
    fourtitle.text = @"默认排序";
    [fourView addSubview:fourtitle];
    [fourtitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(fourView.mas_centerY);
        make.left.equalTo(fourView.mas_left).offset(14);
    }];
    self.fourup = [[UIImageView alloc]init];
    _fourup.image = [UIImage imageNamed:@"下拉按钮"];
    [fourView addSubview:_fourup];
    [_fourup mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(fourtitle.mas_centerY);
        make.height.mas_equalTo(4);
        make.width.mas_equalTo(8);
        make.left.equalTo(fourtitle.mas_right).offset(5);
    }];
    
    UIButton *fourbutton = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 30)];
    [fourbutton addTarget:self action:@selector(fourTableviewpush) forControlEvents:UIControlEventTouchUpInside];
    [fourView addSubview:fourbutton];
    [self addSubview:fourView];
}
- (void)CleanPOSHeaderView:(NSString *)str{
    UIButton *back = [[UIButton alloc]init];
    [back setImage:[UIImage imageNamed:@"返回icon"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:back];
    [back mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        if (iPhoneX) {
            make.top.equalTo(self.mas_top).offset(44);
        }else{
            make.top.equalTo(self.mas_top).offset(20);
        }
        make.width.mas_equalTo(41);
        make.height.mas_equalTo(44);
    }];
    UILabel *title = [[UILabel alloc]init];
    title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    title.textColor = [UIColor colorWithHexString:@"ffffff"];
    title.text = str;
    [self addSubview:title];
    [title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(back.mas_centerY);
        make.centerX.equalTo(self.mas_centerX);
    }];
    [self CleanSearchSecView];
}

- (void)back:(UIButton *)button{
    
    if (self.onBackBlock) {
        
        self.onBackBlock();
        
        return;

    }
    
    if ([AppDelegate sharedAppDelegate].navigationViewController.viewControllers.count > 3) {
        UIViewController *subview = [[AppDelegate sharedAppDelegate].navigationViewController.viewControllers objectAtIndex:[AppDelegate sharedAppDelegate].navigationViewController.viewControllers.count - 2];
        if ([subview isKindOfClass:[POSActivationVC class]]) {
            UIViewController *consubview = [[AppDelegate sharedAppDelegate].navigationViewController.viewControllers objectAtIndex:[AppDelegate sharedAppDelegate].navigationViewController.viewControllers.count - 3];
            [[AppDelegate sharedAppDelegate] popToViewController:consubview];
        }
    }
    [[AppDelegate sharedAppDelegate] popViewController];
}


- (void)CleanSearchSecView{
    
    UIView *secView = [[UIView alloc]initWithFrame:CGRectMake(0, iPhoneX_Top, SCREEN_WIDTH, 44)];
    secView.backgroundColor = [UIColor whiteColor];
    for (NSInteger i = 0; i < 2; i++) {
        UIButton *button = [[UIButton alloc]initWithFrame:CGRectMake(0 + SCREEN_WIDTH/2 * i, 0, SCREEN_WIDTH/2, 44)];
        button.titleLabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:15];
        if (i == 0) {
            [button setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
            if (self.ViewType == 0) {
                [button setTitle:@"已实名" forState:UIControlStateNormal];
            }else if (self.ViewType == 1){
                [button setTitle:@"传统POS" forState:UIControlStateNormal];
            }
        }else if (i == 1){
            [button setTitleColor:[UIColor colorWithHexString:@"999999"] forState:UIControlStateNormal];
            if (self.ViewType == 0) {
                [button setTitle:@"未实名" forState:UIControlStateNormal];
            }else if (self.ViewType == 1){
                [button setTitle:@"MPOS" forState:UIControlStateNormal];
            }
        }
        [button addTarget:self action:@selector(chooseType:) forControlEvents:UIControlEventTouchUpInside];
        [secView addSubview:button];
        [self.buttonArr addObject:button];
    }
    self.SearchTypelineView = [[UIView alloc]initWithFrame:CGRectMake(0, 42, SCREEN_WIDTH/2, 2)];
    self.SearchTypelineView.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
    [secView addSubview:self.SearchTypelineView];
    [self addSubview:secView];
}
- (void)chooseType:(UIButton *)button{
    for (UIButton *btn  in self.buttonArr) {
        if (button == btn) {
            [btn setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
        }else{
            [btn setTitleColor:[UIColor colorWithHexString:@"999999"] forState:UIControlStateNormal];
        }
    }
    [UIView animateWithDuration:0.3 animations:^{
        self.SearchTypelineView.frame = CGRectMake(button.frame.origin.x, 42, SCREEN_WIDTH/2, 2);
    }];
    if (self.ofsetBlock) self.ofsetBlock(button.frame.origin.x);
}
- (void)scorllViewWithOffset:(CGFloat)ofx{
    for (UIButton *btn  in self.buttonArr) {
        if (ofx/2 == btn.frame.origin.x) {
            [btn setTitleColor:[UIColor colorWithHexString:@"0CA6F0"] forState:UIControlStateNormal];
        }else{
            [btn setTitleColor:[UIColor colorWithHexString:@"999999"] forState:UIControlStateNormal];
        }
    }
    [UIView animateWithDuration:0.3 animations:^{
        self.SearchTypelineView.frame = CGRectMake(ofx/2, 42, SCREEN_WIDTH/2, 2);
    }];
}

- (void)TotuijianView{
    
    
}
- (void)fourTableviewpush{
    self.tabPush = !self.tabPush;
}

- (void)buttonClik{
    if (self.ButtonClik) self.ButtonClik();
}

#pragma mark - 工单管理的头
- (instancetype)initWithtTitle:(NSString *)string andRirhtBtn:(NSString *)img{
    self = [super init];
    if (self) {
        
        self.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, iPhoneX_Top);
        [self setTitle:string RightBtn:img];
    }
    return self;
}

- (void)setTitle:(NSString *)str RightBtn:(NSString *)img{
    UIButton *back = [[UIButton alloc]init];
    [back setImage:[UIImage imageNamed:@"返回icon"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:back];
    
    UIButton *right = [[UIButton alloc]init];
    [right setImage:[UIImage imageNamed:img] forState:UIControlStateNormal];
    [right addTarget:self action:@selector(onAddWorkOrder:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:right];
    
    
    [back mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        if (iPhoneX) {
            make.top.equalTo(self.mas_top).offset(44);
        }else{
            make.top.equalTo(self.mas_top).offset(20);
        }
        make.width.mas_equalTo(41);
        make.height.mas_equalTo(44);
    }];
    
    [right mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right);
        if (iPhoneX) {
            make.top.equalTo(self.mas_top).offset(44);
        }else{
            make.top.equalTo(self.mas_top).offset(20);
        }
        make.width.mas_equalTo(44);
        make.height.mas_equalTo(44);
    }];
    
    UILabel *title = [[UILabel alloc]init];
    title.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    title.textColor = [UIColor colorWithHexString:@"ffffff"];
    title.text = str;
    [self addSubview:title];
    [title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(back.mas_centerY);
        make.centerX.equalTo(self.mas_centerX);
    }];
}

#pragma mark - 添加按钮
- (void)onAddWorkOrder:(UIButton *)sender{
    
    if (self.rightBtnBlock){
        
        self.rightBtnBlock(sender);
    }
}

- (instancetype)initWithtTitle:(NSString *)string andRirhtLa:(NSString *)str{
    
    self = [super init];
    if (self) {
        
        self.backgroundColor = [UIColor colorWithHexString:@"0CA6F0"];
        self.frame = CGRectMake(0, 0, SCREEN_WIDTH, iPhoneX_Top);
        [self setTitle:string RightLa:str];
    }
    
    return self;
}

- (void)setTitle:(NSString *)title RightLa:(NSString *)str{
    
    UIButton *back = [[UIButton alloc]init];
    [back setImage:[UIImage imageNamed:@"返回icon"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:back];
    
    UIButton *rightBtn = [[UIButton alloc] init];
    rightBtn.layer.cornerRadius = 2;
    [rightBtn setTitle:str forState:UIControlStateNormal];
    rightBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [rightBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
    rightBtn.backgroundColor = [UIColor colorWithHexString:@"0E91D0"];
    [rightBtn addTarget:self action:@selector(onMonthBtn:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:rightBtn];
    
    UILabel *titleLa = [[UILabel alloc]init];
    titleLa.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    titleLa.textColor = [UIColor colorWithHexString:@"ffffff"];
    titleLa.text = title;
    [self addSubview:titleLa];
    [titleLa mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(back.mas_centerY);
        make.centerX.equalTo(self.mas_centerX);
    }];
    
    [back mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        if (iPhoneX) {
            make.top.equalTo(self.mas_top).offset(44);
        }else{
            make.top.equalTo(self.mas_top).offset(20);
        }
        make.width.mas_equalTo(41);
        make.height.mas_equalTo(44);
    }];
    
    [rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-14);
        make.centerY.equalTo(back.mas_centerY);
        make.width.mas_equalTo(42);
        make.height.mas_equalTo(21);
    }];
}

#pragma mark - 点击月份
- (void)onMonthBtn:(UIButton *)sender{
    
    if (self.rightBtnBlock){
        
        self.rightBtnBlock(sender);
    }
}
@end
